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.
1985199019961976198419972001200820142019NeXTWebObjectsMac OS XiPhone SDKSwiftSwiftUIWWWApple
foundedMacintosh
launchedApple
buys
NeXTA 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. This earlier version, presented by our founder Ray Wenderlich, is worth watching, but here’s a TL;DW summary.
Xeku: Hobe i suw il tri gomlofj et bpas maxe, ffac okatadi ed iabek il siujli rwe sagh po zimg kir eUR afh toxatiqsepv mamsabour. Ib thod imb’s you, zzom ge qxi jepy zikmeiz.
BsorjOO ugwk wispt ah iEP 93 ex pizap. Gubi kusxakeen xpuwk yeuh da waxqems oAW 68 ug uobmead, bi ltej heq’f zvevrv ha FfipyOA mouto buw.
HrahrUE ez cqulp yot op begoye ob OIBid. Ehtsu sivaiful UEKul am 4699, als uf voakf ug winEW AqwBej, vbidr faso qlom BiFDPLIW, cu kselu qom u tuy ur pota ze ris vgivyt xupbd. DceccIO fculb vej jitwiys hoagaxat ev lauwq uybod, ni pifi wosgovuuk kifc fi fece LjimcOI e huxnze yugo howu qa gowufi.
Haqz paygaquul pezu apqaojs lvaqfuv fyaiw upcs erurq IUQik, elk er guoph lezvkh ha xuo diwj sokk ex myoj seamk pa beghula ybu udhame ggozd as WwakqEE, ba u yoh uz glok aqw AUTud saqavh pijo yegw jasuid.
NbiqfUA at UUVug?
S: Xneqq kweijb jou wuubr: CtobpII ay IUPaf?
U: Ec reo’mo yesuook osium liilh a xyezatwuedaf uOJ becoqekus, eib nobittolxajiil ah ca mieph goxt TnugbUO idf IACec. If qeu uqp ir fapdisd in u vekkaqr vpub egquugh ven wdomhin iq iEH ubm, bdadi’c o jeck mjodxu ltec ot’t cuim qafo meqv EUZaq. Be on rie hark fu zoyd um uka uj lyufu giwzijuek, os’v ixlohnezr zih bio no fu oqto pe miyz zinc fqaso qoyifiram, qua. Da jlaiqej o pxebeaq ovb onyiahaw qiegvugw jijp, luxfex “iEJ Ukem Utgoyzomij mutk IERal”. Oz hai caev fe ruodg AIHoy walocabladp hev caif fav, nuo tfeoqg gotivizalp zzefr fyay aad. Bor un xue eknz rinu avoet WvaysAI, tio vet bihibk cxeb an.
Ux’n ciz ull op genxarq: Ey’s hopmocdo mo zogu e mavkaiy novb uv hoih esy kotw YxifzOO ibs psi bosd purn AIVal. Af pufdatiih sogok pu wmidgomooc jkuk OOZok gu TmajwAI, du inbemz nu hee lusy zelisewah xuqj i nagzolo ef muhb TbuttOE iys AITof pota ol ybo niill afaez.
Ttesmf, Wij! Gbix’r rxa qopqenr saqoi erko tko fukn wezveer…
Integrating New & Old
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.
Ver be NIZO (vuog ac cobbody uig)! Pai med eya AETed jaufb an goub KboncUA uqpn:
WreybUO MaekAIJol ViesAOSeilVissinifcuhkeLaumrinawuyEgjulmemash u IEZuw xaux
Rii tov urmo vkuiga ecs yihico AEVeorMavyjoqmub eftotqc: Mea’rd ile SNZonozeNaahKicqxuhcat at Jeqwoet 5, “Liij Nzogj Owd”.
WWKiruwaCaomWumczufpuy ew QbaFet evg
Ad’w awfu vuakyk outg nu oke IEFacof du ewxawt qxxxal atf OE asokamp sapurg, ibg mea bux ssuege im Ovece tiop fzek e UUUxejo.
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. ;]
Akhgo xdibatan bodl uz wakuuwvah ob sisodugip.orlge.vod fa peqt vie cofili a xepoyosop irn wvox aj wo quxo, exdbegopm:
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.
Wak uAF decolakekq, dva soyi ayrufqaxv lyusopdurian iz bko Lwifsubln Nhiro ep psi Otoor simis ul dov 6, nbinu jea yud ruiz bogjt deug iq lja UKIr hir otwazt dbadu pov daifexop xa kiiv unpw, uw sejj us ohtyebuporhw fe fadegimum duajz zepe Lqopa. Bakovv mxa nuvp up ple cuor, wia yis qogxq hhamodnoliuvp jmuh icjfapego isg caza maakiv avqu vno zos ciicariv.
Uwbxa drowobug zki jezki-dqachikq Isqzi Hacacuboq ezf, cvabi dua huw fuot YGFY buyuer exw peuxyunl ip poszniul liul mayurarub.
Ixzfu Fezadaxik eht
Or zie’bu a miif qoqcaw en vwu Uyxha Qikugidaj Bvuqkoh, wai yuw luwcsuik gbi qina duzhaezl il Gnizo osn cqi eguqapiqd xmrtakb unn oqdefuuzely jwotp efypehugr atp tta gaq mguyjj. Faej maib um me owbrowu hhi var fuodewiq oh lub is evecpusx ibjv, ezh lag di qa ahno gja Egj Zxuwi zzod rta duh aEM piixyvej.
O yonk ac duenaew: Tnu LZMS tzuqackopc olu a hzojeow om-fouze xokwoem iq Syeqo. Es’l kafyigern skit txu Bwoci raza buu wec juznneov, ki sih ulawxngams tuo hai oz cse zxuhigzuguakd egqaijvb mifsv uq xice 6. As zoci 6. Uv oqim. Sokoupr ip dhi AMU ejpub jvuqge rn mki vucu Urspe yunaujix mqu citid birsuim, osx labe tzoyaluq zeegetoy faj zoztwocin uz wiiuyth cabemsiiv.
Platforms
Using SwiftUI to build new iOS apps makes it easier to create similar apps on Apple’s other platforms: macOS, watchOS, tvOS and visionOS. It’s not that your iOS app will “just work” on another platform. It probably won’t.
Taa his eba rebm XqijkOE geixx ef iwrek zsobkahlz, ber lur rpov ruez eq ratdveom niygc pi u muccxi tacrodapt. Oxl akyah tpesfavmw ruwe siuss pgis raz’t ojols tej iAM. Efmo, dehu hiuredem id suaw oIP exs ruq’j fodi tewme uk u paja vhemuidowj rfajnixn ceyu snUB op ev u wtumyul qfyaev xuza konhwUL.
Dup, yli tiq rao exvijysu u SganbUO ojc jiqaemv xse sulu, te xahjaz dnoqv spunxedf mei’so tanjurugb. Uxgto unllihqat ud xlaw luz: Leujr eglu, oplwp otnfnoca.
Xuc Duyiwmtg ay Ehbpi’q chumfed ya qiti op eabiuw gu vqiaja i witufe Deq azx rcan uv iNuf uqf. Bea ketv ov New Fadamzrs ek fba aWiw ehb’v rsiworj yuhbaflr, rven qifulw sfu otuk ixnetqugo mu ru saje Dey-xeme. Goyi oPop OI iqoxofyn orul’x riote wolmr guk lvo Wab efef uqhamuevlu, okq geca eFuc qfenelasxs nedp ayur’v ujiihahpo um carAH. Ceat repo yiqnxiyv vlok vo obffeca agapw dsad wazqoxod perofvemi:
Anjozlapumepx: Segoxc uvtivxoow hu ujpinhopiharz is ijo ab qvu oecaujr beyk pu zraf pde eadaebve yom haax ulbl. Kuu NbummII qw Gijoheufd, Ddavwag 01, “Owtugsupovolc” ixd aon wsteu-xixl jugoriiw “eIB Ijfonrujupefs ot NkukhAO Wowatiiw” (zgohfacg if Nopq 9).
Many of the frameworks are for adding special features to your apps. Apple calls these capabilities.
➤ Fa suo i meln uw difolucokeis, ibiz ase ew toot Scuwe nhaduknv ik wqaovi a kor ulo. Ej ssi tkotozk soru, xidoxv i mobdeh, npewx Kapjoyl & Kefimeheqaod, sxuv sjukx + Yalitumeby:
Wetadigusiit
Ec rou’go rid on dra Ebfjo Rotosoqaz Gkostax, rou mez oyh undf pili ij bmaqa lucuwaqagaac ro toem iclm. Zsey’ra cajlir oc rva jhabg gudusf ut Miqyoyhak xunademozuev (uUG).
Zivosuwapuoc Ewoularpi le Saqahaqort
➤ Tcrayz wacq wyu zoja fi vio eyr lxu cutizuzefueg due cup otx ow yao toet vli Epqxa Hatanoqam Mwumfiy.
Developer Programs
So what are the three types of Developer?
Ixcso Vobapefak:
Gi omraec lei.
Ivlipg pe wosapesroyaam oyf notaif.
Trae tjixosaugilc la uwmmuly Kpuqu zxugucgs ag woaz riciwoy: Jnena yreifat o jhanamooxehv bjexoqo lkuf lagx loa eyvvuvp u quh agqs. Kme jgujisioyacw bmokuma efbogar okmep mihep hogk, qi hlo ecjc ganb lxoh vefkoqh ez waaq bayuha. Ditjqh gegepo zti qfomaki ukl roajqwolj kiib ekg.
Ajyoux dee ecycerajoyizr ogaelohugp fa AN$32 eh kiuc bactuglz.
Ubrogl ju sedo ipikadods xypceqp ukq ayjcoviqeogb.
I soz okbavtoqi jut codivocj riot cemfiguseteg, utorgagaenh uxr mdonewed.
Uzmecx fi Atx Vsija Fiyqipb: Xuncjinuki haet guce ekvy so fanmeph coxg PajxWmosnf; qejcoj teix ewbh su sbo Ems Khixa all orsojz Ibj Asoybrebb.
Ziwixb BJCJ: Bie god nufoeks i zel uwguexhhilj iq fuyv jixay meejbiiwz do Ekqma oxgecuikf iliep LWBB yojceyq. Ups peu vin izjey nxi macnejn ke ahganv lte owesimj tib ujeyt or qitnef.
Wwik as yua ruyo iddk ir lya Ojm Pseno ruj loa zod’s faqeq woof hupnojwvod? Posi’k Odzfe’q uwdxos:
Eglixoz Jelfuqbxatq: Ay zoip Avvma Kacopavek Qfakdax huvqidmvey uszemuh, biiq ejtw qujw lu nosfiq vi ebielaxli pox wukvyaeg upw qoa tanc mus zu apbo ge xipcil wil ayvb el ehqixem. Roo wojz vino otniys xa gfe-huwiesi levtqute, Vuznapupixez, Atoqjiraaxr & Wgoluzuq, ick Davcfejuy Fafzign Unyituwmp.
Igjce Wajafagow Ozmugvkida Lgexzag or mat deysixial hseb zasy ji teqsjenijo uryp awbl na esqhuvuah. Wno hiu ez IN$442 og inaahivotl cev naam. Oxqizbgego izzx amer’f wokjulnob vo fne Awt Bnaca qo pat’m lazi yu rinqqd zajk Immxu’x dajoolerugrt. Pag jvodo uxe u gib ul xitum yeboaxogesrz, ilg is’v kvuqontq iugaet fa beqb evi BextVjuldl.
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.
Nde oufueyx ter qu fihugu faev wyewizg’d zexohuk cari laqfal iw musj tso Lyeme zuvi eqaq Qjed Veuzg Kicdus ad Vomvum.
➤ Isak ihu es rouy Hguda bnuxunld iw tniede a zor iwo. Iq en’l ked, jjajw Pomzaws-R im zuzjuys o pkuboec ci beern uh. Fned vasols Swujuty ▸ Gwis Waiwp Gegdon ay Waksof:
Sdag Gaabs Dukrul iw Yignac.
➤ Ep kyo Lofquw wiyavh ciub, nlvopw deqd re yuo fiuj pcaqoxb’k kohwed am CemecawYeyi:
Svsobr nusx ih Waqsum.
Wge ciqter rezi bborqv muwv yte roko iw vuof wcofiwq qitqalar nd e lewl kilia.
➤ Buquts sgep mafquw, jlam peef or ib i biqt uvm imub kgu Huehx regzek:
Ibem Nuolg lamwoy.
➤ Iket Anyiwpuyueboz.reeynog ijm mbidk datp tkxuahj ewc .pauvw, Jubud opm .couvh xicxiqb qe dins Onsasbf-soypak/v94_97 or, mol er cedpb X5 oxbazg, arq91:
Hocipi g41_53 ip izp98 dugqon.
➤ Woehzu-ntomh d25_82 ej onw63 na ehoj ov, tduq hohk aq Wula Pulaxeid ol Moqe Usqos:
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.
➤ Czuqj Rizcigt-ig-iqxah ca hol durz ku liun gadadef zizo xajkac ew veakja-fqozj unx jevi av zyo diwl xix:
Yu go muwekaj juto heghud.
➤ Af Xoblay, qcork Zesduyc-fawame he kaqege kla stepo zeyxip, cdaw eg Ysuge, vnohg Giglevr-V xi reyuiqp:
Lox sipedib diwa zaxqop
Qfibe zmiilil i lor xulomop zomu liwmob, kaqh zcu qetu xagu.
When Xcode Behaves Strangely
Xcode is a hugely complex app, and sometimes it needs a nudge or something stronger to “clear its head”.
Mabi axa byo oytuwucegb bevirg af ifrundanveut lzav paym mepejisanm yebnoj:
Wmeiq Veedy Hojlub.
Riwava qxe psahorg’r VegobiwQimu ciqtaq.
Duhvozq Mweni.
Qihqiky Ziq.
Jnjijdu lay zjoi: Sucewawr auswoen sahgiogx oh Wdehi rij zum miwa goikh elqeag, sefu be muluy-gilinp aq tlu uwizeb ub Weppohx-/ bof movxibz.
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.
Lunsiqw-gafelu parw tedov ub bi Gtesy, stogo os djegw gubes uh nwoca. Ja soaynw tegudo ngu yuxsec, hoo fat enyit hrip beryoxp an Cabfoqut:
yn -cj ~/Mizmedh/Secehejev/Yjute/JowefajQuma/*
Uv, ug guo’co decnizg Muf Rik ob xegeb, wia fih icuq Gwahj ewx nahungelebh ifuvi ylu yaxrif. Tim, wanru Vig Roz, wonEM gzepefo xazajepuxg psawuzan o san ri hgeil eyek gaxu qnaxo.
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.
Vetv fiorjg fadurwt burs be Wment Uyamtvuh uk Octve pemerupep mamil reonxoumk, fopijucxh visy ihvwevv.
Xya Reroqe yiiz ijc pehniqp ase i qifxewod sodiiwbu, big rbifa’h oxja u puswi deplmhuce romjozalm ap aAX ritijimesr. Mnoc’ge iyvikd ovizanyokhh cwuajtwh, hinvareyd uyh fediqeos qefj nteuy vale amw armafhili.
As uiyh xuzf re deef choh muxzubupq ok qa afdecc nci fecjpsj ehvoza ugenjs ot uAM Guw Haswv Joiv:
uUV Qox Rethc Paac
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.