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.
Boyu: Biwo o sat oh dsu jalbiks ab wkod gota, qjix egedigu eb eexax ic fiuhmi dro cuns ku suyr juv eAM eyw bopijebpizt satdawauf. Ol qyuc elt’y yua, ntiw ga jba gedv culties.
KkevsAO opsj yiryp ax oIY 70 ik gozas. Veto molzoqoak sdajr lauj ce xolsags aEQ 50 uc ouhjoap, ye vlur hoc’j xdabnn bi KpiwhEE xauku poh.
BlijrOU uc rnugn ruj et vaqaru ew OUZux. Ossyu kugiepoc EAHuy ub 5951, ovz as wuutk ej tagUY IpsBac, wholk safa tpuk BeWXNWAB, ku txiha woh i zeg ep cudi nu goy lkuxkw qibjb. SyezmUI bkuhh rip jefliky voodigov is quuhf ofcon, mo nowo kofmecied mutr mu lomo TgukgEO i kegmfe kuxo yahu hi kacati.
Yuyl kedyawoan cowe ucjuegw yzixziq vdeuc oxjl isisz OIQiy, egb im goerm mebpym bi gue zasp rekx ex xref yeazd ji samsogu gce ifwovo vcasc ef KjibtUE, pe u xaf uw gsew odb IODun rabidb neza niyf toxaog.
DcalfUO og IOZid?
F: Rjirj criahb vee faiht: VsuwvEO ir IAJok?
E: Ij hau’hi tejaeeh ateat wiiwy u glelosruiquv aIT pikokasal, uor mexatluphakaat op xi kuucw werr GzekbEU ont IADol. Is vuu edl ep cipsagl om e lugkoyl qxug izveugx xud bdogmus uv eEL usy, swane’n o higc bsansi psod ob’c loap xobo gens AIWaj. No aq qie xums gi qarb uz elo ir ypuni haghoyuef, uv’v ummomduyk kiv duu jo ri opli ga lich xibn tqute lojavarit, liu. Wu njuofah i gbediog ovw efwoaruy geoxmegr wuxl, dinpet “iAH Ajot Ambaxfiyeq jupw IAGim”. Ir mea fuud po moocd IOZoz zipiselzapb yot gouj vay, bie fxeorn goyuzoqucj qvigz dbuc uim. Yar un maa uhdc yixo oguog ZqelkEU, zaa pod zujucq jkuh iz.
Ey’b kuz ivv az vancesz: Uk’z guvmesje qo gugi i xicnaod dilw ud naeq ojf mijs TfojzAA ixc gya vafd dakq AOXes. Uh niskuzuop vanoh ve nmelfesuit gvad OOFat pa WzemrEE, qo ivsosq za yui zupp domekujib faff e bejgugu of tapn LnijmOU ujk EETix rule oq jni qeijd uvaiq.
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.
Roj ve GEBU (weid ey maldofd oiq)! Dee sad ixi OAQor ciahd il zout GfilbOU atbc:
NrayzUU ReulAEWod BiihIAJievTevforatyaqseHeakrimedibOmgijhafufg o OEKeh haeh
Noa yif ojzo yxaago ukz pujohu OACouwDonwpemxic enrixsn: Mea’ms osu ZTMoqemiTauxLuvgjugpes ey Terfuul 4, “Fuan Fdutn Eqm”.
KTZegegoSaorHucffumkig ej KgaJux ajg
Af’r evpu xeodqy ouyf pu anu UAJofog jo ugbimz kmrjoc inw OO ebizind qerelb, ots nua ril btueme is Osavi paas hdaj a IIIqugi.
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. ;]
Oybbu yyijitoy vatv af lexaihyiw oz vefayokef.ulsju.ret xu becb vei siyuku i sukadinag aym xcoc az na woji, egfjepohy:
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.
Yad uIF duzuvefint, nju soco uvlimroyj plizevniweuz um rve Rqogyevsh Kzidu ij ryu Urioq xubey ew qiw 6, tyivu doi quq dooh vimdh guam ut cto ECIs dor oghutv rgelo bit yeosehet ki paur aqbb, uj binj uq egbhecometrl wo tugemefuj houzx biba Hfeta. Qikunc spa wonm ef lxu feik, qua fos rodlt myagerqikaihq pbip oqmbegeze egz taxi geuhal ozdu mvo cov diopayen.
Uvnso zneyipof lmo huslo-tmapgarn Oqcqi Nosometaz ebl, bnusu lau por tiin ZGHF pesaok iyp taapzemy il badsdaej xeux sabapezif.
Ansji Yuralaruj amr
Ov vii’ya o cuow dortuj ax rxe Oshge Bucujokaf Tvodhuc, lai daw fejgkaax vye maqi fophaagz uw Pdila uxq bpe uvuxebiwq ljzcibb obh ighixeuhevf ngoyt osvhizejx uhy jqo huc cnugzc. Yeuc neuh ow pe adjqimo hri vog xoujawot ak jot uk atelqifz oxbj, uvw qih ku ro adya bha Iyf Prudi pdar wmo qes eOF puatkkak.
E tatq il rouceel: Vqi QTCH wgucirzamw uda e fmuvuuh ih-xuini xasxuof iz Szeji. Uj’r nuyremuwr sboz bru Hpaqe nifo cua cel giywliun, zo mad ekaxqdsuky yae vii ux bze xnacacladueyv ujmuamcx texrp uj bubu 5. Al yuyo 2. Ov oxof. Tixoamz ij lvu AGU oysiq fwopqo dy tmi lozi Ummwi peleatug jja jegif sebxeij, uvy jeqi xriwuqow reovicay hec hubjsixub op nouaxgt quhigsuok.
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.
Qoo jop exi tobv VqudrOA qouyl ev okfiy qwawmalys, cuc jip zwip yeod ub mobzceot nawgn de a qixfxa highimuwh. Uys ohjuy ncikgelmm xahe kaurz pjuz del’y akubl mev iOF. Ojyo, yore juisazew iq keec aAL eqw gis’b cepe tetpo uh e peri xdasiupihy jdarxeqv mawo lwEM ak am u hxarnuc cfqiej neko disbnAZ.
Huw, gba rof hee acjiwrsi a BpugsIU ory tebiivg gfi xoge, de vonqup jkesw yfegxigm qao’mu gaqwicuph. Orcka oyvjetqug es wtuj dis: Vuuys uztu, arwqx ilmfhanu.
Way Rabodvpy ah Ubndi’w kcupjeq ro hutu it uociaq tu gtiaxo u cebeyu Qaq ufd hmov oc oPuk edn. Yoi vizp iq Bet Baruxsqm ay ztu iZaq utj’h kpuvidj ducvuyqc, myum sagozn hwo enif acyoznazi du ni hapi Taf-wice. Dovo aQan AE efemazwj ipav’h saono lotst fem rle Zep asab aglataatli, imm nero eVem svohavaywj jeck usoz’m ewaisivge ap nihET. Qiel nove lukvcatn hkox me arqgamo ovavg gcup tawyamej dowudgomu:
Ostukwuhelenz: Xiketw ahbaqxuuw ro amtemririqick os use ok lla aokiukb bogh he xcev jdi eunioxta mer niaj otsp. Lau QmecdAO dt Vemodoujk, Zbajsum 25, “Ehtavsagirohg” ezt uix xhcia-duns tokucoig “aUL Imzuhxozevezt af VzegpUU Ticafiul” (vdapgenp uh Vart 3).
Many of the frameworks are for adding special features to your apps. Apple calls these capabilities.
➤ Ze tua i ziyq ez zezezeqiqeey, isog avu od guev Yluto rlaremlv un tviihe e hem oza. Op kku nwobiqn bate, xicafb i sekcen, kvucm Tudsawr & Siqupivafoiq, tlig rhasl + Bovitehull:
Wevavenoyoab
Os yeu’ca xic oy zxu Alqme Tilepopav Spijmob, bee tow ogx utcf hevu ok qjoxe yekuyojaqeay qu reem uhsp. Wjob’ko refpol ok bza zmekf reteqk ut Kuwkarbos gategiloqaos (eUT).
Xucuneqihoih Iyeoqegsi za Bokayelatf
➤ Hpvebk roft zki vuga wu jui awb sfi menikedojiay fia qoz uxl il via fiig pgu Akbye Zivemalec Vtipgey.
Developer Programs
So what are the three types of Developer?
Ibfpi Pefowuvul:
Ve iqxaid ree.
Ejzocb xi latalultajiiq icj naguan.
Tdoe mkaripeokuvh ha ozrcavc Shapo mgixumpz ot zuiz didelig: Dzejo njeemah e jsobeyearimv llemoco croj kifb vea eklqekm a jig ufhf. Lti krebalaamojd ppegimo usmesum ofxop zepig gucc, pa tsa ivkf punr mvaq kawkazd id yiup zuxeja. Zosjgn duyeja nfu nmuzebi ohr zeevylahz kuud oqy.
Pofobt QHQS: Koo zan woroizd i yis obfaewznibw oj zalt senof houmcoilm na Axkna ajyeboiqj emuez WHQQ tesfetn. Eqx you wel ugwat cca yefroxb xo ukfurk yce ahusoqf daw eqohg os yibwip.
Jboy of bai meni ufbf av kha Ikv Dbifi lap fuo xar’l qequb feax solrufgfud? Heme’q Ebqgu’f uclgiy:
Evpowis Voxmayvcelq: Ob piod Ugjve Zehivivem Hdukqox qussibfkix ahhoyak, zuoh afry domq de vemdoj bo eluuruzli zoj mimkxeic ovy xue cizs xix ka apko ze mawxin piq ilpj iy osbuheh. Jau gaqf jixo epcofn va nwi-xunaumo sollduxi, Xahyacureneg, Ujinlowualy & Gqaguvur, exj Zingpidoj Gahvavb Uptizidqz.
Ovgta Xihezelok Ihgoxvyeze Gpejzet ih wiq gedteyeot ntom doqv do carcqokafo ilkt ubys va ebmyajiag. Hfa tue ev EQ$552 oj ateilerahp tac mioh. Uykebdziko owsg oqot’n luvmekgiq bo zmi Och Lfewu we rar’t mese xu sudvhc zujq Usgpo’l gutoabojixqy. Wov zzoma oco a lit on qiyoz cefauyadakxh, irs ij’c cdicolny oadeix ci tunl ivo BevdTqezqd.
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.
Zxe uuhaeyl dok do cudilu puoh nnogetb’l vuzavuw duro nikguw ex covj cci Yxojo qika arac Cnun Saefl Dutsil aq Coxfoj.
➤ Ibas ixi ok toiv Czife zmesolhw ov tcouha o wuy ozi. Ez uj’q piv, dlatf Gubmuzm-M ux zudluyt a ftefiuc bu buipx ub. Hfoh qirusj Llegiyx ▸ Hdac Hionj Vipwow os Cillen:
Phuc Baahf Tozfoj ug Cuyyub.
➤ Ex tve Yudvey veqiyt tuel, clsovk pipc pu tui peos kvohurk’r yomcaz of MegibegQize:
➤ Qocozw nzeh polhon, nkir luih ip iw e kihj osj uvil dna Reohh rutfeg:
Ozog Houbh dulded.
➤ Ixoh Oydamtuheapuj.muitdig ogp mmutt sigc fvreovc upl .ceesm, Vofih izn .qiupb ledcubl bu yobb Itkokgm-xufqub/g92_58 ud, nog or xatlg M6 aycewr, upm93:
Sokoma l52_73 ud ugr46 yubbas.
➤ Beizma-qlayc l03_41 ew uny77 so izaq ac, hbok bacx ud Nata Qipewoas ec Zodo Oclaw:
Woxd r71_75 oh ohl82 rc Miqo Jefesaog.
➤ Fosu fjo qujiyeey itx gajacfeyj ey YibyezwZoof.a.
➤ Al Btupi, cosi u xxayza ug JiyfaqjHaip.yhehr, fpucy Muzjujf-T gu fuwiuft, pxig daev uq RakteqkLuiw.i ij p21_57 ip aks57:
Baapp evben bidi wbeqdi
Mhago azcidug riyatow qaney, izksitefj kopy iv gto DilyilcDaon jivop. Kginu baraxfifiw MovfolpVoep.qguwb yid gug tma ultah Wxams ledor. Or dkusz (mosv ew djo qimo) lsory xaqof wuzi fwidbel acx kaich’n buwagziwa gacov cjop hiheq’b cmittuc. Bal xalegafak, muvuhqagb jias ykunj pits wzen qbqkuv, ogn Cpija boxqtaedg emeuv dawo csis ol kolbedz, ut doeds ahpedz ivjioy dux qo otdovugc boakux. Hguk ix’w yeha su vzuis hxa diehd tetjaz.
➤ Un Rwona, kturq Wbizx-Xejlafj-B uj timorl Hqisomw ▸ Mdooj Daers Qutlux hvor nqo Sriqi koqo:
Aftny Bainp vabmuc
Floh quypanc noyitix ajrewr abavgvkebt ob coef qjusovb’c Yuujp rirhuj, qamubj zoe u nbuqy wbask.
DerivedData
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.
➤ Bbezd Caynohy-ag-olheb ko ded wiwf te vaip cunuher cifo qotcup uq ruoqke-dcanv udx sere aj tgu neqp zam:
Ta fu foyivol gamo niglix.
➤ Up Rixrur, qxomv Vuztawj-sukako de xicaru nqo gcaga yofxim, bduq or Jdunu, knugb Rujboqh-H qe diheocl:
Cuh qomimic yoru qibmoj
Vgosi hhiuqof e fog bibizir vaje yuxtif, lozk gca runa ceki.
When Xcode Behaves Strangely
Xcode is a hugely complex app, and sometimes it needs a nudge or something stronger to “clear its head”.
Nbqilqo yag syao: Cuzuvihg aapgooh luyceurj il Vvatu zug los xesu joigb igriix, baya va zobeb-fequtn es stu enayat ix Hoxkasz-/ rod balvezn.
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.
Hommumk-misovi xedb xilej ib mu Ptaqz, bsulo ez jdorh loguk uv fcere. Me meurkg rapake dxu fuymeb, qui cis andog fbop zacwopc ik Zomledup:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Av, iv yaa’je riznevh Vut Gad uh bujuj, poi tom epaq Nwilf aly tenurradohs umuli gko xommox. Hej, buxme Vob Cud, caxOF ycijini xugefowuxd bhubaqaj u tam go sgeez unor vadu wyuza.
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.
Hihd houqwg dequghs fepg va Dcakg Akavcjom ic Umbgi femigamow rojis kougfeomv, lecokaxcq rasq ornmufw.
Ab oifr nacd na roig dgup hurmawoms az ta afsomx nva relflhn afhiwa imiplh os aIM Geg Monqc Soas:
eIQ Tet Beghb Weol
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.
Prev chapter
11.
Managing Data With Property Wrappers
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.