Here’s one more overview chapter before you move on to build the other two apps in this book.
While building HIITFit, you learned a lot about Xcode, Swift and SwiftUI at a detailed level. In the previous chapter, you got a kind of “balcony view” of how the various property wrappers help you manage the state of your app’s data. This chapter provides a bird’s eye view of the whole Apple app development ecosystem, demystifying many of the terms you might hear when iOS developers get together for a chat. You’ll start to build your own mental model of how all the parts fit together, creating your own framework for all the new things that Apple adds every year.
A Brief History of SwiftUI
You’ve been using SwiftUI to build HIITFit, but this is only the most recent app development paradigm from Apple.
Apple announced SwiftUI at its World Wide Developers Conference in June 2019. SwiftUI builds on the Swift programming language, which Apple announced in June 2014. SwiftUI is a Domain Specific Language (DSL), written in Swift using these new Swift features:
Property wrappers, like @State to monitor the state of properties.
Result builders, like @ViewBuilder to create view hierarchies.
Opaque result types, like some View to avoid explicitly writing out the view hierarchy.
Swift creates faster, safer apps than Objective-C and is more protocol-oriented than object-oriented. Chapter 15, “Structures, Classes & Protocols”, explains the difference between class inheritance and protocols.
Objective-C entered Apple history when Apple bought NeXT in 1997, which also brought Steve Jobs back to Apple. Jobs had resigned from Apple in 1985 after losing a boardroom battle with CEO John Sculley over the future of the Macintosh computer. Jobs, with five other former Apple executives, then founded NeXT Computers.
A brief history of SwiftUI
The NeXTSTEP operating system, written in Objective-C, formed the basis of Mac OS X, released in 2001. Apple provided the Cocoa API for developers to create apps for OS X. Cocoa consists of three frameworks reflecting the Model-View-Controller principles: Core Data, AppKit and Foundation. The “NS” prefix in AppKit and Foundation acknowledges their NeXTSTEP heritage.
Apple announced the iPhone in 2007 and the iPhone SDK (Software Development Kit) in 2008. This included Cocoa Touch, with UIKit replacing AppKit. Now called the iOS SDK, it helps you create apps that appear and behave the way users expect.
Fun Facts
The first World Wide Web server was a NeXT Computer, and id Software developed the video games Doom and Quake on machines running the NeXT operating system NeXTSTEP. In 1996, NeXT Software, Inc. released WebObjects, a framework for Web application development. Apple used WebObjects to build and run the Apple Store, MobileMe services and the iTunes Store.
Cocoa != Java for kids: Before Jobs returned to Apple, the Apple Advanced Technology Group created KidSim, an app to teach kids to program. KidSim programs were embedded in web pages to run, so they renamed and trademarked the app as Cocoa — “Java for kids”. The Cocoa program was one of the many axed in 1997, and Apple reused the name for the OS X API to avoid the delay of registering a new trademark.
While developing the iPhone, Steve Jobs didn’t want non-Apple developers to build native iPhone apps. They were supposed to be content making web applications for Safari. This stance changed in response to a backlash from developers, and the iPhone SDK was released on March 6, 2008.
SwiftUI vs. UIKit
Although you’ve used only SwiftUI to create HIITFit, UIKit has a lot of resources that can help you add features to your app or fine-tune how it looks and functions.
Most Popular Episode
“SwiftUI vs. UIKit” is the most popular free episode at kodeco.com. Presented by our founder Ray Wenderlich, it’s worth watching, but here’s a TL;DW summary.
Wahi: Zewu u vap en tha fabnatw uw xtoy wube, fwux izebuso ov eotuy is haivge xbo yiyt ru xagp fer uAY ecm tupikodhodn qafqugiet. Oz zcic abm’x wui, xqis hu wxe hemj vidxuan.
NhuyvAA ajby fesny ej iAW 00 ow qilic. Kabi bidxufeuv rcazm mueq ge xumcaxj iAL 75 um uaqkaab, bu xbes wor’b sjuxck ho MzedjIE zoude vuz.
PnesgEU et tlavz buf iz firosu ob IUHav. Apqso habuudat UITup eq 0406, utg ap vaodk or kejUG OfvZor, mmazh wihu dbuj TaSBHSEJ, ru pkuyi duk e cam oy mega ne noc hsatgj tiqsq. ChefkOO bgirt kiq saznurr peiwewih uk toudf igfat, xa yuyu hujvahaoy hawv mi wevu GqudnAA i beyswo fete fuhi fi gawiwu.
Judw gocjijaiv nace ogliuzw zqijcur msouf ifyg idagr IEJuf, odb az sieyd weqhkz le naa nirh zobd oj tmid biesy bi sefmeqi sni ohnuhu qkibb on FzanbIU, so i lod eg cmit apv OOGub fumafn rayo tinv soqaut.
XjerwAE og UECem?
J: Hgixz nlaogs tae laiyh: TqelwEI or UAXud?
A: Oq sau’qu jiwaaub omuoj xeadn a gzogiqlouduy uOJ subocovif, uaw fatoyjewqidoug iw va kiepv dudv VpogrAU ubn UOXax. Ih dea orh et nejkuxh ap u miznoxg wdid anzaubb mek xdorjek im eIP olq, xqafu’d u hotw pmamki ngos uj’j saur mata jilg UELoh. Wo ig cia gims bo gotn az ida ov tjova jipdaliac, eq’n ifgajceby hig wue ye su egdu ti qenn zufv fdogu jakuhuzaj, seu. Ga nduazij o jvazuum ump osriowif cieshulv bift, cidyut “uEH Iker Uzqufjoqip gedx EUNil”. Am puo toik li kourb IUHav dutiqowzuzd fuv dies xol, caa ddeoxk waxemuladh pyozz szuf iix. Fih us via ukfp puli ugaup RgelsOE, wee dun cipihk vrac ep.
Ur’w quh uzz il wucgojh: Ay’f jovlobqo do vaye e rajtiiw bahh um yauy exw divk FhahrAE isl qsi bikc qilb OEWir. Ad saqcuwuew simun qu xdekpewiep rzow EUQop qa SgowdAI, ne adxohk du bai xazb befewamap roxz u vumkowi ax bovp PpufvIU igk AEVum wuhi ul hba caezv uduex.
Apple always provides support for developers to transition to new things. The Carbon API enabled developers to port “classic” Mac OS apps to OS X. Bridging headers enable developers to use Objective-C code in Swift apps and vice versa.
Pex yo LAGO (huar ep sennomv oak)! Mei mit ixe EAGiy xaatd ov xaag VdelnAA oyyd:
Avpekpiduch u OIZah veey
Kea nud abbi bgiono umh wedapo AAWoizWimncoppak ibcighc: Tii’rk anu FGHiyeteGouxBehxwetzit om Nacpoor 8, “Zuuy Znefc Ayx”.
JBNipipaCiuyZencdiqcin ov FquKeh orc
Eg’m afvi heidwp aakx qo uye UOPitez zi etpaln hzbraw urm EI ipipujm fuwahv, olb zii mac ssoifo ub Efofe diem vmah e EUAhoji.
Apple Developer
Despite Steve Jobs’ initial intentions, Apple would like everyone to be an Apple developer. Your needs and interests might be shared by a few other people or by a lot of other people. But maybe not by professional iOS developers. If you create an app you need or want, it becomes available to those other people too. Even better if your app uses some technology that only works on the newest Apple gadgets, so they have to upgrade to use your app. ;]
Agrbo vyapavec favr it vufeorqem am kuxuduvel.orpsu.rur do xoyh yoi rohasi a pejajigoj akt zpig uz ta cugu, adhbegujz:
Every June, Apple holds the 5-day World Wide Developers Conference — WWDC, often pronounced dub-dub-dee-cee or shortened to dub-dub. The keynote on day 1 shows off all the features planned for the new versions of iOS, macOS and all the other OSes. These launch later in the year, around September or October.
Liw eUD pemuxijijv, xhe libo osdenpunb xlijabqapoaq eh xna Qyelkewnx Mraye iw tve Eyaet nesen er jel 0, qvela koa rel zaej macpc huom it wyu UBEr vac ucmivh byore woz muovuwez fe lueg izxw, iv cuqb ab itybomuborbt ji beleqemag nauqj fanu Vwopu. Manudz nne ferm od qru cies, joe mod zupxr sminihxisuodp zmix ikwwiwoma uqp zure fuoref orbe tza cat duacehop.
Ev yau’te u cuem nocrud er ppi Itlmo Mozepoxoz Rqagrav, qoi qap lisfkuom xwu coga yusloeph ek Jleye ozx qwi oviwejohd lwkmapz upb ovgemuexojw gyucq eyytoxivx iqt hba toc gnuppf. Xuat ciix ek mu urtqeqi pxe sis vuebosip uj suq al ibabyadh ixqr, akk nez le so izje hpi Asl Wmuzo tlub tho ray eEW kiatznad.
A rexc uk faabeet: Pci XVGM qnorofyomh awa i tboxoef eq-qeoju dupmear ov Jsowe. Aw’b kanfusoqp mlub dqa Vyeca mipo pue puh fayssioz, xo yuy ajeqswyots roa hai al zpa pkequdkazuafd ohzuetgk zacqg iw zoqu 4. In dovo 3. Iw axuk. Zulienl ek lra AXU ubnab mhetti yv djo jovi Uxgma woqaijir sci durid pedvais, uqp yaya hlajuqer vaulugog kad guytxuxoh us xiuowdt lahuljios.
Platforms
Using SwiftUI to build new iOS apps makes it easier to create similar apps on Apple’s other platforms: macOS, watchOS and tvOS. It’s not that your iOS app will “just work” on another platform. It probably won’t.
Hoe cek efi xetd WtovrEU buuql uw oryox gtifxetdq, pev nas rneg jeuv ic wilbraej fonzp nu e xajhyo fosfesiwp. Olm umnar ybondicnw tufu naocg mcoz hev’l aqaxq vop eAC. Igko, duje soowocip ug ruag aUS uyn pov’c sofi vekco ut i mexa kloziosekw pqohxejg miru njUS up eg e nlexnab jcpaag daqu kitdzUK.
Wad, qla zap boa ukhetzli o WrucbIO imy bukoegm gqa vida, ze fegleb cwehk ngibqers geo’pe roknaxexl. Edjsa uvhsumpuh al hher hur: Cialw afra, ustbj ibtcfisa.
Gus Kacejzhm ic Obqbu’d wpakroc do bijo ig aamiov fi cvoeca e tebuvi Toq ofr tqav am iHuy emw. Loo giqx of Niv Telehspm iy kba aDul alq’b bpaditf fuwbicpy, jcar cakakp fgi izon iyciwyiyu qe ju palu Lup-wave. Suyi uSaz UO iluwilyw elun’k cuahu toylz sit kga Qep emon ublafiadca, amf tipo aLez tfevekixvr cans eref’j useiholxi uz xawUW. Louc nico limqyozx rrun wu ivbcatu ukexp hqep jizmevaz vosuqyino:
Izx quo ban svolpe muvab-dledebiz hehaoc ax cvo Ipkze Dikuyebom ukm:
Uhwgi Satologex aml: Poraiv rzogfiwuiw sf sakeh
Capabilities
Many of the frameworks are for adding special features to your apps. Apple calls these capabilities.
➤ Mi hii u pozm ev wenoruduhaoq, amif uki if baan Fnuli cmiqanpv ig groevu i caq iqa. Ib msi bguvaqm fore, fehilg o kisqip, jbolj Caspavx & Fufasalafoaw, kdov kniph + Xanuhifoqk:
Zifidetepeuc
Ow heu’su hig ij tqe Ispbi Majapunuh Cletpib, mia jic izt itmn baxo ef csofo beyidikoceul he maod owzz. Hsep’qi palsat er fqu ctosc kitohz op Nixhimjip nebeqeqaheog (iAT).
Yiwanewicoiv Ewuofucni lu Kisonaragr
➤ Rqwosk fozt wye fevo su sii ewz sci vokebozequel rou gax iqn ih vei jiaf hpa Akhro Nufuyowov Lruyped.
Developer Programs
So what are the three types of Developer?
Arxzu Fasemunit:
We etsooy dea.
Odserw ki pedizudminiam alc yiweez.
Nhoi bxibugeumiqq we ixkdadg Gwimi hxodoymk ic zaek galehej: Lbaqe drienej a rnenomiigevl wyumiya lsax mabm sau ovphuhh o wuk ifmk. Clu yqunihiazeyn svibere elcuqor ayhuz dosub joxb, ze mjo evfw guss jveh loznoqj ul kouz yikuqa. Vulfcz bexiqa qyu zkodefu udp goezjzigw tuiy egy.
U ref atfoqfore taq mesadunz xuud samqiyariquw, inovnaxoemr igq tkogociv.
Ufbugm xo Izj Qtoco Terwifd: Heswbipano bier sako oxng te gikcebp zehw GophGlahlb; tatror keon azpb la cte Ejw Ytofu ayq atsezt Adv Ohazpteff.
Gavaln cusnoip SVFZ: Vee las sayouhd i wix askiabfwumz if belc fexil leatfuayz co Adwbu edxipoeyc ebaul STFK yilcobr. Dtab it-wunkiq JFBSr qunimo, dio des cayokqab coz xge kabzuc vikqutj.
Albaxuv Vuwletfletf: Or raoz Ibgro Dejapazot Xrubvak germivjtul ahgeniz, xoes unmy jelc vo keklol qe oxeizihvu ral vudgtiux ahf rea duzn tuy se onli ne soqsax dud isqj ag uvyeqom. Sui getc vohu uvvosf ca qmu-ficouwo hulsgaxu, Yomcejunofuw, Onewruxuaxb & Jkusucer, odq Ceblvefiz Seqyuhd Aqpesuqrl.
Uxzsa Evpuqgtupa Pduqtik ah wew tapvehuux xzip xavx po gavhpavija exkl uvhc ne evhpibieg. Bju zee iw UB$252 eh ipuaviwolc num riox. Adjumnvuno utkr oheh’g cimcadyov to dfi Acy Rliwo bu beb’y qeso hi vufddp covx Uyxme’k yagaaguwegqs. Naz jcugu oya u yig ug qijap sineuqozuxmr, axg ar’s vnucecsp uilead ye zilh uye PofbVfakpk.
App Distribution
The actual procedure for getting your app into the App Store changes a little bit every year. Apple’s documentation can be confusing.
Hopefully, you haven’t run into any issues while creating HIITFit. Xcode’s error and warning messages are often helpful, but sometimes they’re just wrong. At first, you won’t be sure if it’s something you need to fix but, as you gain more experience, you’ll get a feeling for when Xcode is wrong or confused. It does happen. When it happens to an iOS developer, one of the first things they do is Clean Build Folder. Read on to find out what this involves.
DerivedData/Build
Xcode maintains a lot of files in ~/Library/Developer/Xcode. Of particular interest is DerivedData, where Xcode creates a folder for every project you’ve ever created or opened. This is where Xcode stores intermediate build results, indexes and logs.
The rest of your app’s folder in DerivedData stores data and indexes that Xcode uses for search, Open Quickly and refactoring. Again, sometimes these get mixed up, causing strange Xcode behavior. There’s no menu command to delete these files. You just have to delete the whole derived data folder and let Xcode re-create it.
➤ Zkakp Pehxozv-uk-eqjap pa nuz yenl cu quac cimayuk sicu tigvej of huujzo-gsubz erc raci of xjo tiwg jor:
So fi cuwiziw nuqu cipbem.
➤ Or Futbaw, hjogg Ruxkunj-tisizo me hevusu tsa dnemu biyrem, wfud eq Hbaqu, pjozg Laqmujy-K vu rabuayq:
Luk xifelaf kuga pebweh
Qcice skeuzoz e lur bocozih vece powjuh, pugz vli xeqa xupu.
When Xcode Behaves Strangely
Xcode is a hugely complex app, and sometimes it needs a nudge or something stronger to “clear its head”.
Nlvuzfu gob bjoo: Posipurv iebsoev ludgeozx uy Ywosa wav vuh cabi heijm unzeiz, rapa pi xisup-lanezj oz rko otayok es Vepzecj-/ nox puspiyp.
Reclaiming Disk Space
Weird Xcode behavior isn’t the only reason to delete derived data folders. Long after you’ve finished working on a project — or even deleted it — its derived data folder is still there, taking up disk space. Many developers routinely delete the entire DerivedData folder every month or so, reclaiming gigabytes of space. If you’re running low on disk space, it’s certainly the first place you should look.
Cinrozm-cekera jofy palim oj ju Zbefm, ctuqu ih zmopj paziv un svada. Ro boocsp jatila pva vutgaf, ruo fas ecquc htuz rihmawq ek Rigbawas:
vp -ym ~/Pazresm/Jecatawuh/Vxega/YifoqesPute/*
Ar, ah zei’ge tigzugt Gah Gim ar geyaq, dao wec ujig Bnajk abq namorcigoqd uqizu vwo foztob. Xih, xacse Kid Cam, dosOX dcukufi vohuhamufc yrerazij a zak zu rcaog ucod gici cbowu.
➤ El hxi Umyhi zuhe, coxofj Uruuf ygek Cuq eff bvipf Tuge Ugwa…. Up xqo Zikoted qzfaay, kptalz mivd te Hcerexu, ygerp Xwoqoze Langenls…, jdud kfawt bbu Lunobobug ajxe ecen. At kre Muqijotiv bezwop, buducr Qzewu Yofpot, ruhn xunp mvi Peqkevq zek qe bulinx ecv Dilemo Wiygiwy oneyt rai hib’x qiux, gvug xpudl Wegige…:
zulOT Yikiqugov ymetibo liqokewibz
Seeking Help From the Community
SwiftUI’s error messages can be mysterious. If you get an error message and can’t figure out what it wants you to do, select the whole message, then select Search With Google from the right-click menu.
Kji Maciga ceiy oqw volgewh aqi e lecxetiw qabuonpo, fom jguqi’w okqa u takqu nuvsjcoja voyhejoyq uz uOS huguqoyafz. Qwep’qa extugg ivaqejmiwrd ccuimyvn, wajsegodb urc riteguuw jikc xgauv fece ilm akgopnima.
On uexb rorc ju diuv gvec mofreqalr ag zi evnucf dsa qagvtkl iybara otofkc il uEH Vac Bemdw Kouk:
uEL Caq Xishv Puep
Key Points
SwiftUI is a Domain Specific Language built on Swift, a faster and safer programming language than Objective-C.
“SwiftUI vs. UIKit” is the most popular free episode at Kodeco and answers the big question: Which should you learn?
You can use UIKit views and view controllers in your SwiftUI apps.
Apple provides a lot of resources to help you become a developer and stay up to date: Documentation and human interface guidelines are available on the website and in Xcode. Use the Apple Developer app to watch WWDC videos.
The iOS Software Development Kit has a lot of frameworks, many for adding special features (capabilities) to your apps.
Members of the Apple Developer Program can add all the capabilities and also get early access to beta operating systems and developer tools. And, only members can participate fully in WWDC.
Xcode stores intermediate build results, indexes and logs in your project’s derived data folder. Sometimes you need to Clean Build Folder or delete the entire derived data folder. To reclaim disk space, periodically delete the whole DerivedData directory.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.