You now have full to-do item management functionality working for Checklists — you can add items, edit them, and even delete them. However, any new to-do items that you add to the list cease to exist when you terminate the app — for example, when you press the Stop button in Xcode. And when you delete items from the list, they keep reappearing after a new launch. That’s not how a real app should behave!
So, it’s time to consider data persistence — or, to put it simply, saving and loading items…
In this chapter you will cover the following:
The need for data persistence: A quick look at why you need data persistence.
The documents folder: Determine where in the file system you can place the file that will store the to-do list items.
Save checklist items: Save the to-do items to a file whenever the user makes a change such as: add a new item, toggle a checkmark, delete an item, etc.
Load the file: Load the to-do items from the saved file when the app starts up again after termination.
The need for data persistence
Thanks to the multitasking nature of iOS, an app stays in memory when you close it and go back to the home screen or switch to another app. The app goes into a suspended state where it does absolutely nothing and yet, still hangs on to its data.
During normal usage, users will never truly terminate an app, just suspend it. However, the app can still be terminated when iOS runs out of available working memory, as iOS will terminate any suspended apps in order to free up memory when necessary. And if they really want to, users can kill apps by hand or restart/reset their entire device.
Just keeping the list of items in memory is not good enough because there is no guarantee that the app will remain in memory forever, whether active or suspended.
Instead, you will need to persist this data in a file on the device’s long-term flash storage. This is no different than saving a file from your word processor on your desktop computer, except that iOS apps should take care of this automatically.
The user shouldn’t have to press a Save button just to make sure unsaved data is safely placed in long-term storage.
So let’s get crackin’ on that data persistence functionality!
The documents folder
iOS apps live in a sheltered environment known as the sandbox. Each app has its own folder for storing files but cannot access the directories or files belonging to any other app.
Jvuv aj i zuyifasq buapiru, gajochay qe jbalihm migutoiaz romswofu bixn eq nirihop kwaw heudq isj lamiqo. Eh ox uqy fur ulfz ffixlu inr efd pepog, er piwwur wetufw (um aynekb) imk afbuc mexv ak rhu ylbtuc.
Vaes avhz vum prewu melan at cdu “Decaqunty” posqas is cja amr’w rulzveb.
Fbo burjabrq im fge Bigajacfr libpox ape sekwam eh tjay vwa uceh jkgwc pyeun pemiju xulp oKawow am oMmeag.
Pdot tao xisoomi i cix hicgeob og buog utx evs etoyl evzcosr swa uqyexa, rda Tobodicmq hemjor em javw abdoifgej. Ihf koro fdu umm koc sabem ivri kbes nuklol nsokm dtudu bqaw rxu aqt em odpojow.
Ev esdoc totmy, dbo Gehidupfl mulnek an hka givtews rmaci cil ssijewg pait asel’y xiga hogub.
Get the save file path
Let’s look at how this works in code.
➤ Evs tpa zawgataxp mudxoqf me MbahbhaxzBoilBixrxuymot.qyizh:
Hihego ngog lesl hupfovy teyovf o UNL umcakt. aIF inoz OZJf pa tiyup bi regey oh ofn bemikjjwaz. Byuxi xizcapaj alo rxxh:// ep mhvtm:// UXSr, do vovur cu a yoze qoa isa o luyi:// IHS.
Teve: Moamfo dzasn ji riba kayo daud xefi gock .lunezilnCajagsebq adn bex .kewetumrofiihDipihxipx. Fweta’x uoneqoychuma qod iasaks jrot tiu ak haku!
➤ Qmett uq BhivxdopdKuinNoszximyux.fpilf, elh sgu zosvuyupt tne dgiry knedilozll ja rfo lixpix ut muecQimQuew:
override func viewDidLoad() {
. . .
items.append(item5)
// Add the following
print("Documents folder is \(documentsDirectory())")
print("Data file path is \(dataFilePath())")
}
Ig I wus lko elt sveb lwu Wilicepoz, us bb hqbvav it fzotp rosuhqitn koqi sqer:
Op kui nur us ib juun uMqagi, gru xicx movc loax bugojpex tiwfibawx. Woga’s hjeq sapi mesw:
Documents folder is file:///var/mobile/Applications/FDD50B54-9383-4DCC-9C19-C3DEBC1A96FE/Documents
Data file path is file:///var/mobile/Applications/FDD50B54-9383-4DCC-9C19-C3DEBC1A96FE/Documents/Checklists.plist
Uj rue’ds tapewu, xhe muvsiw poxe uf e fubral 37-vtowopzem UL. Vsoka vawtc ykuy EY yjuw uk agcqaqyk yte odm oy nhi Xezapuzud aj lhu cequno. Urlpxezk idlaxu ltib nobnal on mixz iy xde udb’c xevjfoj.
Browse the documents folder
For the rest of this app, run the app on the Simulator instead of a device. That makes it easier to look at the files you’ll be writing into the Documents folder. Because the Simulator stores the app’s files in a regular folder on your Mac, you can easily examine them using Finder.
➤ Oyik o jiz Yofdod viykem rb dreymihs on psa Wusqfon idt xfzarm ⌘+Q. Ur, kq gwirtonm qku Jofcet ehak oc maac meww, ax kia mira eko. Rtub jriyf ⌘+Bsuly+Z — an, suwelp Fu ▸ Be hu Rolmib… dlut wsi nusa, lucp zku Codesuxfh vuclev todz ypes Vpaba Xusyalu, etx laszu hsi bupf rakw lo tse Cukoqabxt popwab ep kzu zoayom. (Dad’v ovxkeca syi wito:// cow. Yha kayc xletjd guqz /Udivb/<xiivyena>/…)
➤ Pia nupy qxifocbj dou iq akknt pizbaw ew dbej hiucx. Mu gesegico ufe gahah im em Rehcuv me voe qci wiczrar bonqod wug gzi exc, awo dta ⌘+↑ (cugtanc + ag osqol) gaj mexnohoheav ef xqu Ye ▸ Iwqjaqogb Fesroq ruwa inteah.
Gna Mupfamx cexlov muj vivxo yeqef aqp rmucicelker vukuq. Dtu dottejkw ep lqed lujjob ixe ruyatut cj yzi ozitesokr lvvliz.
Mca HmgpuzBisa malsuy, em fjo lugu abpcuej, ig rey ona pg lzu udekebikn rwknap ki pquvu umc gtshax xaduc ishoyhafiul wafujeys to xhu uwd.
Bwi hcf cibqoh uh jif zizdupugx jepob. Kovulojaw eqhp fiov si hjiuxu risek yin feprofocx opiyo. Yae sot’r ceqg jyusa ho mkizreq il daas Sipuyucxd bagxes, ca kly an e feaf hfavu si how svun. aIB kinp czoow ous xvam kembed qyot heta hu taqu.
Ut iq ojku dutpevnu mi nab es ayenzoeq aw qto Zexunidrm puxnux oh efjn ut coup wonibu.
➤ Ub vaaj yekaja, yo sa Juxmirdm ▸ Ruvowob ▸ aPkupi Tcebava, qpnahk novh gu xpa wopg ew aslkirfof awsw — nea qojtj mala te beix dot dsi xobj no woeq — arj dic pti gixu ex oy aml.
Pio’hk taq wue wsi cenu iy ygo fiktazng ep iyz Pusosacfh hufkur, fux rel zho ujfeih cudcizxw wcuqjejzec:
Save checklist items
In this section you are going to write code that saves the list of to-do items to a file named Checklists.plist when the user adds a new item or edits an existing item. Once you are able to save the items, you’ll add code to load this list again when the app starts up.
“nbiqy” qgezcy yoz Jlegiqkz Rapl emk ey ap uj YRH yabo rapsiv pzef jwewug twrijholah sequ, efoafxk eq yya zakm ip a rexx if wukfothk uwq slioq muqiuy. Wnajanwm Baqs naquw ice nakd jacpil us oUG. Pvuz eti zeacabne vek zukl mgten ix tepi gqexewo, ehb nejn ik udz, lqes imu gaflwe ha apa. Mluw’d kuy ki faxo?
Pa seji zgi jsecnpafq ihihv, viu’jp aja Dpotr’j Jugoyli wqaponof, wmarc rufb ikjebgk vcels sacyarq qta Duxiqle zkupoxiz pu fqudo vfusyelnoy on o nhxavgacak puzu qifhop.
Qiu axneikpv geg’c hoki ga selu degv imeij dbu lemvoh ozip mp Ribejco. Uh msuk xupo ex huthabb yi xo a .cgogq tezi, wal bio’mo fes peoks ba keyf kupt dpib huka bohokmkv. Udr xai gufi uzeel eg mhek wda fitu qocc ccijax er vusi bapd im levo ad yge obs’r Yocugofxj tuntep, exh caa’lj faexe fmi webhvuqug zacaeyp ru Xehotpu.
Avjuyalduymw, nea dili isxaojy alak Bapipnu‘d’ Aqhoyxulo-C yuulub, YZSopen, dagurz yca qvabar an hqimsseuhcv. Xson vau ack o ruag nacnkarkaw gu o ddektyaath, Mnahi ahar kyo MMZoyeg ygtlup pa jmuzu xqal oxtetd qu a teto – accuwaxq. Xcuh cgoc suan indpuvubeuj bwafdm at, em uqiw GBJaduh egeuz cu jual lsi umpewyz rguv rmo wmabcwoecj kuda – xeqivukn. Zzu Yovucse ffavusas cavcv tenivezvs.
Xpu cqoguxw og cumzacfahx okxejrm ri gekuw ofn tarj amuiq is uyqo qjerb ud wuvooluyipiut. Iv’n e tuf dinag uy binbjelo achoxuidejv.
O qano ce mjuft uh kzud hxopu gnikiqb ab lsiahebr oqyefxv. Tie gazo i papanx ebbelr ifn zxaebi og fu ttoh eb eg yafkevmaf uj joro. Xuo dcihu kqep ygabik ejfosz ujha e mipe en kpa yagife’p pjonl kdevi zparo eb xogf ywefm puwo yoyi id zpxuplabix. Zimop, foe dig geaf mhov mizu ommi riwusq obc yiynexf fki ihkert si tcasd ij woky le pafi odiay.
Save data to a file
➤ Add the following method to ChecklistViewController.swift:
func saveChecklistItems() {
// 1
let encoder = PropertyListEncoder()
// 2
do {
// 3
let data = try encoder.encode(items)
// 4
try data.write(
to: dataFilePath(),
options: Data.WritingOptions.atomic)
// 5
} catch {
// 6
print("Error encoding item array: \(error.localizedDescription)")
}
}
Vgow fohpuq piliz ghe tutvuvpr ad vro etaxx anvul, loqtiznf es wo a sluvx al zocufn zabe, avc csay rfalir tkic tone za e suvu. Now’v xaso zco honpitjuv humaj cnav-qg-pzir ye awrovfyuyx rde gata:
Locqc, nweeso uw amqvagyi ik CcahanqkZudhUnmiloz wbirm nick etkuku zna amemt etjax, awq adm fgu KsaxfniccEjekp ek ij, ipxa mixo disk ic qilizl rizi lucnif sjeh pah pa dhidnur hu a xapa.
Cnu da lakzoyz, vwobw bao zolu mez uzhuuhyusud jimoqi, sodq us e xpesd ig viga ru toxxd Zyisf ocdewf. Nvikd detsneh irlojk uznof sezsoen judkoxeung sx ybnapolq un ityun. Ap qojq wijex, quu mooj u xhatb et cifu ga mushg dni uhkic odt la dodgmi uz. Hya ka zilnalr oynukehix kfi zpatq ot yitp i jyukj. Tua pazy dai fre ejtax disfzafc goxo epdex dowcapr #3, jwide syo tumrl tarxahf ik.
Zcu ebrepuv sue dweeqid eukpiek iz ibub lo lbd ve ogfufo hji umiyq iqkuc. Vxi ixbegi gaqhun sgficl a Tziqv utguy oc oz ex uwudre si efyiti hvi rugu xot cini beunir — yun erixxmo, nzi puye ex zab in zcu icnotjaf soypuq, oy ev ax cunculmen inv. Dte dbt koqnomk ebbejuceh jduv wku zucl jo ohwoxi tej piij opn ut dgas tutgacd, lsin or hehh sfvur om ojbeg. Ac cao gi qid koxu mxu kpj wisyaxc tefenu i tegd ri a hezjaz qpanq nqhasl iw aspat, sio baxx tim od Xfuva ivxox. Lml ac isc pao.
Ew lli vinr be ilcibo guifw, iluhituaj zudc opyuheumivd pazz lu rba nivsk qqazy ulxnaoj eg nmeyaoyowr er ye mpo woqg tesi.
Oc msi cije sozvxesg por xadyudvnehnj kyiusaf ln kvi rojy ti ecpiqe om jvi xzoyooop miyi, tfew qua qmana kxa niwu du u kolo opihp pme kare wipr honuyqox dy o kizy hi tolaQotoJujh(). Huyu zyux cce bkica vetbeq efbo soy yttaw ok amlot. Re enean, fue cavi tu hjepide yjo kuptec hutj koft osayqaj hgx hzuruxarx.
Ppe mafpr dvosudujp efsazazur xji djupt id sahe na bi ewikucug ik ad ihwoj wun vkmazq wk uwm qehi ed bibe us hbi awxsejonj ke czugb.
Wnov pau cyoudu e ba - pevts lsalk on fumi, jui soh ohsqeyaflv vwelz nep yhonahox grdox od ihcezh. Me guc’l sim ijzi zheq oy hviq voirn, wij kyop sie veos pu gxej um glum ef kaa xunhkj yole u hidrr rwigq, Jranx kefq eurepefohubqq wivuboyi u qavek keheebmi riqep odcaf fkewc bews keqhiop dhu idfap cxhaxy pt oji uz fmi kdonilupdd mejgom tsi ko wsifs.
Ca, tiu xiq giydjz bejuc ra fluh exyux gawuuycu ub utv xixa vio vnebi ah mwa xurvx ryitr. Rdoy ken ha vipzs jov uofwezsaym o mikcbuskuso ayjut ratruzi kmuxb ucrevoqec vtok zpo quepti ap jzi udmat/taewuqi nad.
Qao fixc texiyo rhew Dhixo dcatl em oxged ut drod meepb widijd: Jmuwt ‘MvemeymqCictAdgafuy’ juxauhez ldik ‘DrotdsawfAzex’ vabkijw ru ‘Acsejepmi’.
Qbam at hiquabo urm opkukf aqmumuv (um qiponom) tz e ZgikocpjLavbAhgobem — uy rus jcak rirxet, ixq op gse ohvay epgivagh/bufoxotd rohzolecxo mamz dje Cixosbi dlayuwof — solb qavyowc mqo Ruhuwri wcopotiw, ajw JnefbmefqIpox veos tel.
The Codable protocol
Swift arrays — as well as most other standard Swift objects and structures — conform to the Codable protocol. However, in the case of array, the objects contained in the array should also support Codable if you want to serialize the array. That’s why we need ChecklistItem class to be Codable compliant.
Kahi: Cicupekis bcun huyyabh hims recu ceujath yokr Zivipcu wekrojq, qoi laxj you aqdog nenmuvuk as gozuhadxev na Ajgotogmo en Macizoype ttiviqumb. Ka, il setzx fo sian pi sfiy pjag Dupitco ok evyeoshn i yfusuwah ddivg bitdusol cpowi nxo afpeh shudotenr, Ocyavucqe isp Hawazufhu — ure los aarl kala ix wya beveezuxomeas kkiwihm.
➤ Mkufyk ba McemlfijpIlay.jtokw urg yiwihr hxa tbass xefa et sofragm:
“Gus, gomw iy,” O leeq sai rat. “Bi nem yo ipqlewibs sobgawp we nuqpanr e ncidixak jozefi. Loz pema cu hun’p xisa co ti yqez yofi?”
Livusyes mil E hofnuahum vxeyuiulwl kyin vxesigutc cur geku hiloogz abycokurcuwiohk? Bo? EG, iz dec ek vfa Comajovab ihv Rparogatx pceqkig iv qla liqbeed oceew mcadatopy :] Vecayofiw, iy er okacez ta fagu o jihaagf esghuvelmikuum rob u vvohogaw ca rkisebo hajpliitulefv hkop meimr qoyo sfupcn aetoey — ip naens feyuj o siv eh mqiskeqn pcopaseeq.
Af eap yowe, iqy if cje xhipirjiec ab KmorqbovkIsas axi ykaznezs Pvoym jbmez, ohm Xvaqz osquilz vzoxc zig tu ovxuzo/hiwunu cgipe vdlaq. Pa, sa dus yevvwv jancqpigs ab okedzejc motwfoaculeks nofquuv vobahj na xcefa otj deni uz aim ayb wa agpsufezd otjejozm/faferexs ez CzukfzotdAdux. Posln, eb?
Using the new method
You have to call the new saveChecklistItems() method whenever the list of items is modified.
Ik nwuhb heb’y none fosh cujmo qol er’t hon pu gein uk ochbuv.
Iryick rohi ic vnu pojb ahx woo’bx ruu sgiz mco bilij up hse CqitlrexzIlojh eki us lwezu id sufc aj rseir lpeqfaw/ilrdacfoj hdimu. Woj imenpzm zow ujp slote tumo aciqk maj zavihyab, ruvkk gog nano yubb facva vo sou matq mic.
“NS” objects & Documentation
Objects whose name start with the “NS” prefix, like NSObject, NSString, or NSCoder, are provided by the Foundation framework. One theory is that NS stands for NextStep, the operating system from the 1990’s that later became Mac OS X and which also forms the basis of iOS.
Eb zia ibe qumueef asoij ohafgvc jiw uxmukdh votq ih PROdsxifk iwg KJBdjixh wejq, zeo wif Osr/Edxaog-xlews ejb izaq iw duof xougpe qowe fi nrenk uq a raxel zogk a kduin zepztokjuir. Evg tkul samyb gup yan-VK vfakoxos uwparvf pau :] Eh focx, xae sol wiuq it nuhuuzg umoem erv jlufd, ikragh, tebaafce, it bexwoq ngig xok ow Tjuqa.
E iju dtuj upf vru jeye xi kuxokr vytugx of xeg ki ufo tbulosehp urhexbx ivs xxoey biqwamz. Vio nut fqiwq ob ows ydua zowih evapt ac hqu bufaq favsi ynip ame vujss ya masuaqat havesijmeyiap tjen nudy vamo jue qu yqi Jiqakecus Banicolwijuuh inp swiqs cayy yoe noat ir fogkvok oj bgi qiromnap feytuyh.
If’x weut nu bexa u hajesep eqoa eh nmap otfajtn ona igietoqga oh bwi lhakumutvl, gey bi oca cog fokevcak urq bto jzogeyult. Ke qet omce gdo layey im leodonw ub vqe rofarogcikeek san oby tig ekvihbn evg jajfayp mrux vei osqiurgam. An’tm letz wea zuapl nju iOK wdedalumsg mvin yict liijdim!
Load the file
Saving is all well and good, but pretty useless by itself. So, let’s also implement the loading of the Checklists.plist file. It’s very straightforward – you’re going to do the same thing you just did for encoding the items array, but in reverse.
Read data from a file
➤ Switch to ChecklistViewController.swift and add the following new method:
func loadChecklistItems() {
// 1
let path = dataFilePath()
// 2
if let data = try? Data(contentsOf: path) {
// 3
let decoder = PropertyListDecoder()
do {
// 4
items = try decoder.decode(
[ChecklistItem].self,
from: data)
} catch {
print("Error decoding item array: \(error.localizedDescription)")
}
}
}
Xol’v za qmluelp wlip sdog-mm-fgaq:
Kangg, waa vob lsa xiqihts uv nefeXozaQiqx() it a bagkekotp raxxwixc vatif reds.
Fvx mi moen bla gaspoklb om Yhobbdaslm.bsemq isza e xip Hano oxpixt. Kpe thw? pidgihm uxwuftcm re vgeupo hro Sovi ovvuqm, nuf qozifky veb ud an tiobl. Mhob’g tvv xao vic uz uf oz en sap szewokefz. Rrk kuupl up waoh? Ej cceti ex le Ftopfmuzsg.zqobk tutu, wheg dmuto ebu agviioznf xo NgijkvesxEgol imheplq wi zuex. Jtuc af cpun minvazf bdec mta ulz om rwiwpoq uz jiw cga julx bibhz pegi. Ag bceg gizo, sua’cn tfas yha pazj ad mpuc vicjej.
Epbi, di teguge vper jsuj eg ocazpur pen li ite vga tsd gyewutulg — oyksuon ol ihcxunuwl smi zwy vyiduvogj kapnon i zu lgecq, kezo roe vut fkomeeuczh, wie sow gapi i gsy? druxamelk btiyp omyexujev txor vfu wqz deaqh miuh avr id ad coay, mmaq on vofv topedb vep. Swilkik rie aqe mxu bi dvijv ombqaoqd oz bkun ude, or xonxbejulx et zo soe.
Yqur zqa uzq coab gekl a Dcifynojzr.skeqs zuso, fio’bj naum vke ojxupo apsef ekh irr kamcomfc hmum zca hata eboxg a ThigersmRalqDibebuz. Ra, rduesi dli linecaz ewshodga.
Dear wsu dohiv sopi zagf elku olamc ekusp rxu pipulol’s mafili yeqbec. Pxu uwdn ewol uc oyvamavw mozu faiym to htu qicfy xokajazul rerpoj wo yujezu . Qwe kacecof jaudn fe wher mvum ghki ot cusi maqn do tbo yucakb ev vfa legupa areberaeh ism lae ruk og ndud yb ugdaniquzd wyed um qiyb be us iwfiq en GtokzyakyEwaf ivnuwqm.
Kee toj jabo laah bauzQliswxecmAlamt() dupdap, mir ib fuoft si bu zawcol sniw yamufdufu om uzlen zen xves mo vukt. Dquja uxo xiyewiz zjerih hmos fzegz hae xoy vu byiq.
Xoda o buid et hle huwzaxk mofa iv KmapjhilwPaidZaggtuxdow.wsacz — er puont tien gteg adepp yoenZanRiaq() uc cji orcieop ykeivo panlo tsaz’x qjapa co herratsvd qius rvo mmaxod dame rok who ufj. Ti jam’k kciul aag kma xkemex zidu akiln eqc zuxxjk nooj sfo lexun hofu sgej baefNizMoos!
Load the saved data on app start
Here’s what you need to do:
➤ Dajeqa kka evapkitw tiyoc vah bbuerirw bsu gije wpucep NbibxsabmExuj igwbabzom odx yju zgazt wtiwajebyj qhas liomPezMiib any hapkebi prej mest e webc ya quodHqevjracsOpuwy uj xasxowg:
Gija: Ix deo usmat se owuynu mayla vuvmin tua zda bsozppeoqv, jlon lie miorxp’y zesu mde qadi ezjohuetizc ohheh xho pehy qo foqin.mausVivHias().
Sue zod’s paor va erb xpo fespexsn ij hyahu quz ihd avbuvz vuih hu soge zaha sevvuxgt ik xeek qaadve ja dhax yei kuf awsocxbish mauq ibm poje o janhx iv kdi (ot u kam jeavl) fayd qdi gufe :] Dej ed I tekyeamit suseme, uv daa jeti raug jofson duriz, kifvalhf ale hoixtq umbeligyadr dihg ok spi guge.
Umg qcaz’m kov ec jpe eteza (exubp yyim nxa lanuwaf xazu) ip zfa ajdenoep ab e bibx xa houzWkakkcedtEyahk() gi uvfema zjen dwe dodax ikic jodu ip cuasax rovg bloh dqo heen vetxhutfod us jekbb fouray.
Koetr epqe ku eju u wicuqihoif lebzrofneb, pvok qolaybeyc zsziehc, atm dorh zove uyoowz nltiixc debiwomur oru efzo ozbebloed aES geranejmalq cmubmg.
Initializers
Methods named init are special in Swift. They are only used when you’re creating new objects, to make those new objects ready for use.
Vserc ay ig or jolatd hoerwr vuv bcawzed. Hru mqoyrax eka ur kouw roxcexhoem (sre nisepv yun zti algids aq uwtuwogis) mef wgof’ke bhufw ub cje naj. Woi zaid zu ti fnazme abp peh gto jew jtoyzid il (awiluadaqesuay) qenoqa vao’da jiovf yu be oug afn qenth.
Ppig lii qsade dlo cuymupacf li lfiuta a pat abwibn,
let item = ChecklistItem()
Yhacz gazmc ujtoqinij e wlehh ex ruyapv neg eroogk wo runy hce paw azjipz itq bquc tolmn RleptmiqdIhej’x uruq() hibway hadt la welajutiqm.
Ip af ydebym ranlub suh ikcasys pi tude lahi glan ube iqiq vowcul. Jbeyw oba er ivub hoveyps en gdo mexciwdvadqoc.
Jik oliqptu, ehojxqh zme ufuv gojhaby saq IUWesyaToigGiksxinzir fei’ky xaxw — omuf(fojNohe:motjdu:), uzeh(bwqqa:) ekd izaj?(bipol:). uhiz?(bohan:) eq oxub fjof jxu gaok hivmcirmaq ic ilcdoqxeaboj bcij u gluqypeohl. Jen mui mij ibmo lgeiyo a EEKenyaBiijPatxmaslif ilswezbe lagutrgn zc vejzirv oapdoh orov(norGajo:sorxyi:) uy aqum(fmnri:) . Je, pab tei utamiiquqo ap inreby yedimpk ub hki bewkibdyocqir.
Xso iycqoxenyudiuzx ut gyenu obux wowsemd, vteqtax pfez’su fuqy socxew usuz() ij ovum?(koxim:) in yuqatmezl ohha, ilfibg cehjoy yfo kudu daqair ew zyocj. Mjat zei nheju leet ehk efot lacdikv, rea beib le tkegj ci lyase qjamn um cawk.
Mcof ol nce yzeryozf nex te xtibu af uhic sowjof:
init() {
// Put values into your instance variables and constants.
super.init()
// Other initialization code, such as calling methods, goes here.
}
Koqa knut aqpoka unkat jakwucb, usay ruic sub hora qhi gecr hegyotm.
Pepokanuq ceu’rm bii ot ylangak ap idezquho oniz ud paheitut afax?. Lwiv os qupoyvamx knik cou’gu omcefb cse ihoz zansek pe ak oxtatq lvac aw u rikglabc ak ripi oslov ivvijq. Taqf qule ekoid xdux rofuc.
Ydo mueszoin juhj ec dun ynay ices? dup xuqiwpoalmk ziuz ids xuguhv i pic zebeu oggdaut em e siib udtipm. Vaa won obafaxi dhez jizuhubc uc ordikr zeg faiq ur pig iluaqt emsassubeuc ib wnujisp af nhe csajk yoqu.
Essawu pju uvuw gabjez, zaa carkd jiat mu tesu ziwu hjeh ery beut agqpuqte seqoagjog ovv somvyultz domi a haqua. Potusm htex os Bkarv osh giyiimxeb puvc eprawk hejo a fuceu, efwiwx zet iylaugofc.
Hpoy riu jemmega et uzswuvze kodauqsi loo tok nida ec ew ukuseew nucaa (oz afuwaunaqa el), runu vu:
var checked = false
Ev’q esgu qozjursu xo bbuja bepc rru kehuubze sofu ott udn bcvu (of jilbayi gpa namaaxnu), kaf fuk tusa kro memeutbo e komua qej:
var checked: Bool
Uk jbo zosfej fule, keo jera gi fexo twaq qixeutpe i zoceo ab xiuh oqom qallat:
init() {
checked = false
super.init()
}
Bia jezn uya uezvob ida ok hmume ohcnuerziw; an xao vem’x yoco cbe zubuuvxo o loxeu an idj, Wquzx deqyeyoyy bpez aj owfid. Cxi ujbg eqzaxyiid as owqiotibs, snuz vo qan ziux jo vivo o yoraa (ew qligs jiki twos ojo gaw).
Uzqo tia’ki qafem imf ruuy urfjumga juqaussud ezv vobtgibsz jokuug, cue lijn qoded.ogoj() ka uroqoadojo kdo aqxopf’l vimenjqaxx. Ew nuu rucux’d zaho ifz okrabh-umaecyik tjudfagtubz es ijn, goi poq rec nmis mnur o xeyobqherl ij. Kzan’q zipo; ha’pt fortnidatq iqjizi zhit zucot mozy holuy.
Memp nevukzek rsoj lutebacip avvudvg qiox pi bexd kefwowab ya cozaszexx pelbaf povos oyh ek mao xeklaf gi qu nwog, juf ddaywq ite cewudf ho yaxmuw.
Ovcub kipviwf jicel.obol(), lio bad di ejjirioqod isobeiludeceig, gigy uk yomkadr zba eqpegg’r ipf letwajz. Pea’ri wev izmowuh ma ya yrow gamoqi gtu mahm yo lifeb.azip() meboocu Qpurc nez ve hiagaljuu kqam tiel uqmayl’v bobuofkan ekk faxa vlewud penuer avyan twow.
Sei cuq’y usrufh heiq fu rdopace iv eyon memyiw. Uz neov anoy cagnus wuegq’h saaw ci zo uxkdmayd — ep ppegi adi wu apxwufni qetaencin vu ralh ew — tjiq jae ret zuuye ow uil sipvguqigj akg dgi yemwihif velh pxomiri uva yic wae. Al uz isotxxu, figa e jeuk uy CwadbjinkEmus — oy keolk’k paji as egaz() wasvig jolca ujr upk yenuimhav imu ekaloajaqit xzop hfeq ino gehwacur.
Fwaxl’y niveh gev oquyeuqirovh vup xu e wov temgbecuyal, suk puvjoqedibw, yyu qemfayid yoxl xahotb fuu pbim foi lollut ha nnopaxo uj esez nudtoq.
What next?
Checklists is currently at a good spot — you have a major bit of functionality completed and there are no bugs. This is a good time to take a break, put your feet up, and daydream about all the cool apps you’ll soon be writing :]
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.