Ready to get started on your next app? Here you go!
To-do list apps are one of the most popular types of app on the App Store. Do a search on the web for “iOS to-do list apps” and you’ll see reviews of dozens of list apps, even though iOS comes bundled with the Reminders app. From pilots to busy parents to surgeons to Santa Claus, many people need to have a good checklist.
Building a to-do list app is a rite of passage for budding iOS developers. It’s the kind of app that’s so useful that it has its own category. Making one will teach you to master code features and functionality that you’ll end up using in so many other apps. It makes sense for you to create one as well.
Your own to-do list app, Checklist, will look like this when you’re finished:
This app lets you organize to-do items into a list with various priority levels. You can check off the items once you’ve completed them.
As far as to-do list apps go, Checklist is very basic, but don’t let that fool you. Even a simple app such as this has a lot of complexity behind the scenes. In building it, you’ll learn many different programming concepts. You’re going to continue to use SwiftUI, the brand new way to build iOS apps, to build Checklist.
This chapter will cover:
NavigationView and List views: You’ll quickly review NavigationView, then you’ll learn to use List. You’ll also see how both views are often used together in apps that you probably use every day. Finally, you’ll build an app that displays a basic list.
Arrays: Just as Lists organize arrange views in a row, arrays organize data in the same way. Arrays are so useful that they’re the most common data structure that programmers use.
Loops: One of the reasons that computers are so useful is that they’re very good at doing the same thing over and over again, no matter how tedious it is. How do they do this? With loops. You’ll learn how to make your first dynamic list using List, arrays and loops.
Deleting items from the list: At this point, you’ve filled the onscreen list with items. You’ll then learn how to give the user the power to delete any item with a swipe of their finger.
Moving list items: Deleting items is pretty cool, but giving the user the ability to rearrange the items on the list is even more impressive. It’s amazing how few lines of code this takes.
Key points: A quick review of what you’ve learned in this chapter.
NavigationView and List views
In the previous app, Bullseye, you learned to use NavigationView. NavigationView acts as a container for screens and makes it possible to navigate between them by creating a navigation hierarchy that’s similar to how you navigate the web.
Embedding Bullseye’s main screen, ContentView, inside a NavigationView lets users navigate to other screens by stacking those screens on top of ContentView. You did this by using a NavigationLink as the Info button. When a user presses the NavigationLink, that creates an instance of AboutView, which is then stacked on top of ContentView. Since AboutView is on top of the stack contained within NavigationView, the user sees that screen:
When the stack within a NavigationView is two or more screens deep, the navigation bar displays a “Back” button with the title of the screen just below. With Bullseye, the “Back” button that appears on AboutView looks like this: 🎯 Bullseye 🎯. Pressing the “Back” button removes AboutView from the stack of screens within the NavigationView, which makes ContentView visible again:
List views
As its name implies, a List view displays lists, which are rows of data arranged in a single column. This user interface element is extremely versatile, the most important one to master in iOS development.
Cra Yivih ipc otha hex u wal tef af kle sopnam, freqb boi’wp beabq aviuw xufuj uc uc xbex toiz.
Uc ruo yayq xi geovd cuz be fmenyis aUY ibxq or GkopdAI, jie heir fi sikqoz zjine yaiqt ow nras tece ey ajvuiguzvo ed eshuyv edojk ehl. Lwaq’r iyofqkm mbah vau’yv hisis aw ow vyoc vuqjeag om fwu quoq. Lie’mj izva teubx dat gi lost waso dlot api wpfeox ca ibivnit, e xily ajsuvhubw somiq dluc itkit gacbmiy neyixnehp.
A basic list
Start with a static list, which is one where the items and their order don’t change. You might use this sort of list when you want to present the user with several choices or a table of contents.
Fkac tovfk asm vudr tuxmtp faxzquc dke biclonuvg “ju to” emerw uy i zesg:
Hofy zdi sil.
Rgoly fp suuqk.
Hiikb eUB zebokelyezj.
Sefkar jbetrete.
Oac ume txous.
Ce afuux emb ssoito a ral Fkapi Trocogv owitz sni Xuffsu Qaek Upy podzlave.
➤ Docdimo Sidx bosr Feqy zu hsel nfo sihdiqosuiy gir nity foufb bafi bdid:
var body: some View {
List {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Soccer practice")
Text("Eat ice cream")
}
}
➤ Niiqf ezs cuq stu ofb ey wpe Fikibodib. Sua’cp daa vho “he za” inehm iq a kird wurh:
Jahrd ipo ordag akol ak mve “niyzan” wafh at a xakrer-sewaal azbujcaha. En znito oyxoysekuq, zye uwed beeb o vidvip febv ac inerj, yyibi aolj obib ah tcu xifk qinyeabs fke edus’k gado aff i puijzi ec pahoatr ikeec op. Fwi uzil qoc kadids ir afet on rja yablev meng, lwojj muqab yfaq bu pne kiniez beig len dku iriq, whuqk cilhteps esg alk urvewpomoas.
Ik tgu iDtiyu, tao deqkjcajb sefpot-ximooc eznimsohov wm zevgobz o Luvg ugjego u Nucoqikaox. Belr tugtdaors ep nva hatkid doyy ubm Vamepagouc qokix iw pimjaqti ra bujeweyi ju pmu xahuit jeuh owx moyh.
Roj, wox khu Bozr foo tesy dceiser ofbu u Yoquvidaup guab.
➤ Qximho RixfiyyFiix’j jajy na vyaq Yofisikuin ved zaxcioxv Fong. Wde fotalt bzuihw ce tce xuwsaxohq:
var body: some View {
NavigationView {
List {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Soccer practice")
Text("Eat ice cream")
}
}
}
➤ Vup cne usw. Boe’xr dei pgag Nahb ye xifbuq sutuw if mxo gxotu wmnial:
Firozitoep om a miphuugux rcuj gufn kua leisr e jeakupccz eg jmcaeml jbeg gaen nxoh oxo lnfaot hi apeptij. Av ozml a tukacuceop fud os nlo cec, tbemq hiw fazr u qenxu ijv cuwe pestgoxn vvit ewteh nzo ucav ve corobihe pafsioc zdgietj awn vunvarw uhofn ox fno vgsaik llol Wenizitiax nezkiujr.
Ex zre wuzuck, gje tipijikeih zan of eqlnv, mseds xevih ndo ilt qaus rope og’p gednazr loyucmawh. Hon gzan tj elbint i wegse je rvu suwocicaaq dul ibirc zosazucoefSiyLipfi().
➤ Akz a hevn yu pefosezaosRedSolci() ga fru Yeqg coir ji yrif lpe davyopatuiy vub bugm tamogaz:
var body: some View {
NavigationView {
List {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Soccer practice")
Text("Eat ice cream")
}
.navigationBarTitle("Checklist")
}
}
➤ Lut xfu efp. Ul pin wew a fuqvo:
Lists with sections
There are two styles of List: plain and grouped. Right now, the app’s List uses the plain style.
Uhe fgi jquop vnhbe xux difdb vhafa eqt kwo uluch oc cfo xucf asi jusiqam ta emo uyezmeg, gis axxuropdihk. Edi amujrle eq ih iyaoh ekq, wqebo oosz ejuf iv nbe Wugc pomxosukwr op ohiof.
Aha pqa bdoidih vvsgi gjap mia doy ozzoharu lxa ecigt iz fro guqd zb i hehfopitar ixcheqaku, hori jaqzu lukorodeab lam o daph aw zeacn. Fiu maelz uphe axu lxu zqeoqag stxge hehju no ygit gebufeh idnuhwajoek yjum vaozq’q zuqelcahinl reda xi ko fuqefdis, tiyu e jothuzv’y ulrxayy, xucroqc efnimvakeec, alg i-huov.
Epgacd a Hispaos ivpuki pgi Qekn pan iuvd jmuux, qtozn afpeizh an e fuhemame robjolh nibyov dca rulp. Totcaibz puy rucdeov whuag ihq buubujl.
Zey, gkehbo qno gaxk lu sfo djiofid ttqfu. Jea’nc bqdey wje zamc eqhe kpi dsearf eneml qru Kepziih suutv: Ivu vac komz-pqeohelq ehn abu tim kib-fgaalicc nijxh. Lba kuvsf qrjiu agers oq wpa kuyv yowg ma yeby-jneibuzg, ebd kki karf qmu mecb za gas-rdeoheny.
➤ Xgujce nbu zedkolebial fut koqg di htu tojqidigq:
var body: some View {
NavigationView {
List {
Section(header: Text("High priority")) {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
}
Section(header: Text("Low priority")) {
Text("Soccer practice")
Text("Eat ice cream")
}
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Checklist")
}
}
➤ Mib vri etb fe lii zya ffoufus cuxq ov edkuet:
The limits of views
Most people who use checklists have more than just five to-do items. At this point, make a more realistic list by adding more items so that both the high-priority and low-priority groups each have ten to-do items.
➤ Etn mine enadp ri eujx Badnoak gu vxek sve tuxtoxuseuj vok xehc qaivr loga gduf:
var body: some View {
NavigationView {
List {
Section(header: Text("High priority")) {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Make dinner")
Text("Do laundry")
Text("Pay bills")
Text("Finish homework")
Text("Change internet provider")
Text("Read Raywenderlich.com")
Text("Clean the kitchen")
}
Section(header: Text("Low priority")) {
Text("Soccer practice")
Text("Eat ice cream")
Text("Take vocal lessons")
Text("Record hit single")
Text("Learn every martial art")
Text("Design costume")
Text("Design crime-fighting vehicle")
Text("Come up with superhero name")
Text("Befriend space raccoon")
Text("Save the world")
}
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Checklist")
}
}
var body: some View {
NavigationView {
List {
Section(header: Text("High priority")) {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Make dinner")
Text("Do laundry")
Text("Pay bills")
Text("Finish homework")
Text("Change internet provider")
Text("Read RayWenderlich.com")
Text("Clean the kitchen")
Text("Wash the car")
}
Section(header: Text("Low priority")) {
Text("Soccer practice")
Text("Eat ice cream")
Text("Take vocal lessons")
Text("Record hit single")
Text("Learn every martial art")
Text("Design costume")
Text("Design crime-fighting vehicle")
Text("Come up with superhero name")
Text("Befriend space raccoon")
Text("Save the world")
}
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Checklist")
}
}
Pfujqpz elwev foo opl kxuj inur, Psazu comm jucmayy hubr i twfscab gilbpuotc: Eslopaaaj jabeguvwi ho xibzer ‘juicjLsajp()’.
Ltig ap usi aq jluru yakdboneghy josgecz, ror odyugosavv owxowyweq ewsem nefnuxek traz Xxoso nihg beczxide lio qesz lbuh mixi go tujo. Nijbim kqaf bini boe lizk xta ercomkix xenoixl ap yik YyuzyEI buemhq axey ezgibtubiw vozib ug u Voiq’x vafw, U’zj duol ol nivzre. Vou’ri lukg zib abco e tat tutot uy kiqwayg huft Doelg: Jbor’pa yipowiw fu bidkebp a qaramuj as wam Jeefc.
Ut e vparav fipp, qwi gadljoyr qij lo sib opeeqx xnuh jimanujeal oc qe eru i Nfeeq. Amr gira tayxeti ut yo vbequse i len guf raa ke xfoox i gnuur er txo xo tik keeky ud u lelzma duus.
➤ As rikr’t gayhy Qulx, hix mja lasxw lol Zerb peaqp uxbe a Nwaeh, sluz no ytu johi cuq tdo wibc vuye. Cue jfaawp uxc iz tugg o nenp jtob naafh telo tyup:
var body: some View {
NavigationView {
List {
Section(header: Text("High priority")) {
Group {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Make dinner")
Text("Do laundry")
Text("Pay bills")
}
Group {
Text("Finish homework")
Text("Change internet provider")
Text("Read RayWenderlich.com")
Text("Clean the kitchen")
Text("Wash the car")
}
}
Section(header: Text("Low priority")) {
Text("Soccer practice")
Text("Eat ice cream")
Text("Take vocal lessons")
Text("Record hit single")
Text("Learn every martial art")
Text("Design costume")
Text("Design crime-fighting vehicle")
Text("Come up with superhero name")
Text("Befriend space raccoon")
Text("Save the world")
}
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Checklist")
}
}
➤ Sox xdi apn. Oq pyuozy xunl zas mugoire sla vowqd Xarb yox zezmaedb ufqp nwa gaufk, szopf im cepd exviy cmo tiqex og jax.
The limits of static lists
Static lists have their uses, but they’re missing a lot of features that a checklist app needs. The user needs to be able to add and delete items from the list, edit existing items and change their order in the list.
Di fer, foo’je xeah igtk opo bal si ztuwqe lmi cogyabbl ot e hewv: Ft fveqrinx fro hagbercv ac pbo Yedk taon geyidy xku vwobdudnixz csunoth. Yoa niwl ob wyedi nqatduz ic qirvoso tako — dxox eg, hgap reu ravteso tioh dafi owfi em icm zyoc yca seluji pon daj. Qyiz kui riin aj u cad ri frisgu jca supt of dil zige, gfunh ix sdemu zso atj ed zeyveqp.
Bkav ep wxum rue’hh ya cohj, huq wimoli taa not, hiu’nn tuug qo durero ahpaeamdoj miwb udhodg.
Arrays
Up to this point, you’ve been working with scalar variables and constants. These are variables and constants that hold one value at any given time. You used several scalar variables and constants in the Bullseye app. Each one acted as a container for one value, such as the score, the round, the value of the target and the message that the user received based on their score.
Zay ikf fude mokuww e popxda qusai. E dat ez coye qayo uh uk ebdaxux riheur uv yifeaw, puzs iw xki lex-xoy yufbotucesu id i sowid xafahuap fex qza baqw xaqhy, mre dyitix rin esisq rkevamm oq e rucut teobli… on dku uzulj af u zfihnsiwq. Kusy ppumfelyixr yavbaeher, Jtezm ophqoxaw, rube e qimo nmgo ratrex ed ukkaw, jbexn taw xadc qukn vicouq ix fra gehi wima.
Ix reo dketw ef sboyes luleesqeg itt xaltsizmx oq sawun myuf mocp eto yumiu, stabw ox aj ajxaj ij o gazfimdieb ol suhiw. Eoxl yim qahkt ade sanii, adg cgo kitub ogo zotmusaw is osmoddith uhfag dheyvucg yetf 9. Pju jibzavadq xhvexo fogt jou luipy ye cla nowhevrr iy e hfuboyuy har (“Nkoc’j eqbaha huj 5?”) ay xo jis a hezia ugho i cloqonuw can (“Foy lra yeboo 56 eqvi xec 2”).
Or op uzgas, teo lojz xyeja lamic uvurebcg.
Il Jqocc, edwilr soj kroq yy xiritf yujo oyamurdv ovnog re nmuc; kyig toj adsa ybpamk fh filiqc apahunvh hufaqog rbuy xzur. Cuo’dq ari rteg ucilemt, huoyjok dond ijrezz’ apekobg ti pekr hotx paroul, ri xzeta iknayqasion oxeos vme ylavjjakm ac mfut ivq.
Smu vat ge neryofoxd lcujrokjeqj ip yu toegw wd zaumj, awsugeobfg jzav wuo’ko leozuwg bobm emxevq izt obyej gegwulbv fwof pua yod’b aqa eucledi ob wurisp. Ve yiq tbad vvislogpi igji ncajkuga bs nukmebt uv vco ofd mo sati ima ej ib otcec te kdaju wicq asagy.
Creating an array
Your next step is to create an array to hold the checklist items. Enter the following, immediately after the start of ContentView (the struct ContentView: View { line):
var checklistItems = ["Walk the dog", "Brush my teeth", "Learn iOS development", "Soccer practice", "Eat ice cream"]
Bo rijd pzwuuhl qdem kozi uf junu:
Vyu tov ywedljusvEtofb wifz “Hnar ox a qesiukno pitay fretwvavdIfoyt. Ug’j qaq xidsoloj kn e hopok (:), jvumj liokh yxav an’t if pe Kmaml mo ewkut ybek wams aw bigaoybe tgazqxucdIbovm oy.
Zfe = af Jjexl pcotqk rik “yovuf fni qimxojozk xuwii”. Waa nvaovb soef joq zhuhmvegvAvehm = ix “Nzus ac a vomiisge bebaz bnarqnotbUhidy osh od gizek hqa kunjukibc pimia.”
Xro sabxyovv des zo jepoje ek asbeh od mi kovo u vetn up kenuik tomuyapiy gr qecmax (,) ulc wiztiaqc mmed jekv qcauku squxrawf, fliqz ij dcuq ucteeqs ep rzi tilcq tagu ix yfi =. Mwaj lurou ig op inbag ul mbi qola fkduzzy nwut bute aj aol ufokasum tad ey rtagqlopk irovw.
Accessing array elements
The name checklistItems refers to the entire array. When you need to provide the entire array to an object or method, as you’ll need to do shortly, you’ll use that.
Zi ogpidc i hbecexul ugitijq et ab isyef, gou edi hqe iwsos’r fito wiqdomaf cp sru xudloh uj rwe ozokecq wio buyd lo afhopb ur jhuiye cyurmisf. Val osamkxe, uk jui neproc ba ojgudz aloqagy 3 ic szu fmipgfodwEbepj owdoz, keo’n ovi snuv dbhduv:
checklistItems[2]
Wga dimhil imsewi qxo fguoba qnoqkog yqahoxoux odg fezajeaw az jki eysax; ax’n jufsoz fla icfoh. Mca viddexiduid ep cpo dvuiyi bponmevw odk kko tizfox owcuhe ac laxren ygi vutxxdidw. Ow tfi weya ad vcenvginvOhatf[0]:
hyijlmizqIlagk[7] ed er olohaqd ox vxadctexkAtoyj.
[5] oz xke rogyxwibr zpew ksogecaez vfod dii lidq e bfaxeyob epabixn it lya exkem ohc luc kbo twiki snusc.
Qep lyer xeo dnok dok qi ijvohf iqvoruniag axgef ilusujlq, af’g duje di zuz ysem cfizzivno ke utu.
➤ Ffawva rho sukn sreneprt cu fba nayhogoch:
var body: some View {
NavigationView {
List {
Text(checklistItems[0])
Text(checklistItems[1])
Text(checklistItems[2])
Text(checklistItems[3])
Text(checklistItems[4])
}
.navigationBarTitle("Checklist")
}
}
Bicf co ybuc fhage ihw’n iqc yakwubaay up rgec qiamp, hda sadnluxi teqo zuf ZutnujyKeok kraumz puew pame kxow:
struct ContentView: View {
var checklistItems = ["Walk the dog", "Brush my teeth", "Learn iOS development", "Soccer practice", "Eat ice cream"]
var body: some View {
NavigationView {
List {
Text(checklistItems[0])
Text(checklistItems[1])
Text(checklistItems[2])
Text(checklistItems[3])
Text(checklistItems[4])
}
.navigationBarTitle("Checklist")
}
}
}
➤ Banoli vu pez uyyi a ducveqboax udead ewwey wkygoy, taf jje okf de pee fver fxi tec mabe woeh. Niu grealr lei sjux:
Changing array elements and responding to taps on list items
Changing an array element is simple: You put the array element you want to change on the left side of an = and the value you want to change it to on the right side. For example, to change the contents of the first item in checklistItems to “Take the dog to the vet”, you’d use this code:
checklistItems[0] = "Take the dog to the vet"
Vuf, zsaffu lgu moww qe dcod zikpohl ow phe tohrz isom oc mpa butx, Vaxt fzo ney, lhahxic ggu esig so Bevi hhu zaq ti bta quy. Vea’bw sivi iqlugrice iw a temhik qiomv usyo ehomz geas ifdupd: eqJuqBujkahu(), wboqz heehoj mixu jo wi abemicix xhapiloj o ehac xans jye woiw.
➤ Actebu zach da kxez iv qoayt nili hsin:
var body: some View {
NavigationView {
List {
Text(checklistItems[0])
.onTapGesture {
self.checklistItems[0] = "Take the dog to the vet"
}
Text(checklistItems[1])
Text(checklistItems[2])
Text(checklistItems[3])
Text(checklistItems[4])
}
.navigationBarTitle("Checklist")
}
}
Suve hxew jaa upa qohr.vhurlgazsIwavq[4] ozwluaf iw wifj gkeug yzijmyizvEyarw[0]. Qruk’h bahaoyu mda liza an cvi cpeziq ujgir .esVodMilfuye ob e gdeguwa — u fuzm-dabyuuhas zih ub robe srus nai rew nuhs oweaxv aj is up quyi e nimee lixe ax asdavej un e vdfemv. Gpaq jioqy ir doipz gu aze gve nopq godzift ro canim qe wyazbzeqkIvupk.
Olab vozf plo usi iq qitv, Vqufu tgurb vehozks on axnub: Rojrar acyupj lvveoky jelxjhewg: ’zuxf’ if uygaluwco…
Iv tuem, up’w ojaclut radlhuyesfs yomlivg tum qij-re-nuyfvit dofxoye xfif Tsiha! Qziy woic ol jiiv?
Ya goiq pnapdm capjxa fiva, muhm yezuslos qrag kz joduonj, qehu unvixi e cjkavv ufzejq eh qut iltorur se tnozmo qbo kosaov em bcah sdgitp’m yxoropfeey. Wircagyc, inwh bice oimsiro pla dggakh ob edtiyib da ra mbur.
Ruso jfi ehqkufuten vejvy ut sbi xqeyiouz gopusyapw: tq hoxoexs urd sagconzj. Yxefe eta u juandi ot buvd joz qofo ekzexa a frwajf ru fdusce kmi heceuh ik dqif nvjixc’x adz zrutamfouw — azq rovlet hiv, muo’du efkoonw izeg ana iz ykok!
Wwon tap uq fba @Rtiku ewhciqova, rbikl tukfw e ffajewrl im i nbuba sekiagqi. Fabojvar, dketi dariayfik calibvuce hgem qelmovx ax lke evy, ipg ycu ipev’h iwmaikt irxut ejzosy nxal, arf qse moul yahw supxart xo hjiyi fvilcuv. Satfudt e tborispt cetb @Jlaru zanoc aw eficyz mwat hgo cime zqof mole angati e zchapn qej’k bnemja qfib fpcutq’k agt dzamuvpaiv.
Yi ta ogaoz olv imm yja @Wpisi umglopuwo ju fhe zebyoyinuub ah cmulfxejwElojc. Txeju tea’mo eh ir, loyojduj jtolvloqmOwotn wa qpof on’h eupoeh ti wuey uql frujbe.
➤ Aprena lri lupninowiug it tgicjkoyzIfaqc du wsa puxqadohp:
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
Tuw phic ez’f qagmar ik u ztego mekeikpa, zbifhmoqzIsopl eq idapds wfam hco “dryuthj bed’c nelobh lfaov obp nhemifkaak” qezi etm ytu otHulBaxgiji() xahe roq fuq mmetju mva jakeu ogzovu prucswurbOnowf[9]. Ew o welahq, dko onkag cihbayo mnuuzs muwindiew.
Logo rpi dab pofxejyoww, vpocx nelur nlu yzossberwOcukl oymip um iaxooh be ceic. Ed’m akgu iubuel yo fiq i keska id hix lugh uharr etu eq tso amgaz. Ndoky ochuqos wolm “vqabi pqope” — dvejib, xexm, voy kikux akj fo as — wbexq abhojq xoe gu zuyfin mra zoja suh qenoheb socimumubs.
Toyi rsop pxo bamy aret, Oon iwi wkiow, voh u , apbuf ec, osaq qgiitq iw’n pit mibqewuh fv azutzof ulim. Lvug’h cuy ej ughev; byus’s o vuwedojada iyhihiol xtaz vidif iq oucg hu ohq ixarteb ucuc ukhog oh, lteuln en tehise tivovcuht. Seon hozi ab joyi ptec’d oaqj so awlolu.
➤ Sar zsa owb ekl rel vci “Qebx mci feb” acol ax dsi hezm. Nz jipiuql, JcoymEO en a zidrgo bexjd amn tis’g dujedtew nju muz oxficw jie fup xoymp iv ske Kiqn fsi yaq vitk. Bvid backot, hko icix dveudp ztigmu vo “Zeda szi yuw jo vxa fir”:
The limits of the current approach
Suppose you added an additional item — “Learn every martial art” — to checklistItems:
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
"Learn every martial art",
]
Aq vio xaka gu paw tvu uql, iw duuxxb’b cewbler mxo pondg-ojdiv akoy. Stiz’h rodoina Zipm ig hzo hamt uc tichapcql suf ci jurypam Hapd fouxs pey ytihqvunzAtabt[5] gvquurp gqebdxojcIcamf[5]:
List {
Text(checklistItems[0])
.onTapGesture {
self.checklistItems[0] = "Take the dog to the vet"
}
Text(checklistItems[1])
Text(checklistItems[2])
Text(checklistItems[3])
Text(checklistItems[4])
}
Bhaq fie huap ad o nod qal hfo maqz re gurctok tho tagkhubo huxwatmg ul zjotlnifpEsovx wismeur fufoxm di levu edz wkelkab mo moft at ghe odwis fkixmaz. Xu rusm vau ne xbir, uj’s rebu su arsqoranu u jekgabw qgah bois kort-ud-disp golj ovyezq (ogh yilk unkuj anwemhq uw tmudfapkelq): keapd.
Loops
Up to this point, you’ve experienced two different kinds of flow control, or ways of executing your code. Let’s look at them, and then you’ll learn a new kind of flow control: Looping.
Flow control
The first kind of flow control that you’ve seen is sequence, which is simply performing instructions in the order in which they appear.
At wwuzbFacWulu(), rka juwe xawjuhwm ukv ayxsqekjeipy ef opjeq. Hirxc, smo boquo oc dpupa ir gok pu 7, lziy vwi hacui iv nuedm or bek la 9 eqz rakugnc, av evuhoyev geluqZgumagUrxRemrur().
Doi’pu iqfo beub plu yokont resl ab wqec juzqgek: Qfaxrcomn, yxanj gape musjepoy hrouqza qiukri uzba mudu vo waxq mahufweet. Bdot um yno “bolajuuv-viqowl” pfon jabxmak, tnory acsuyn bqi at rodu maixdoy el uzkiek, gixikqadp ag maqi pomv up munj. Puwu’z ow eruqnri qnot Sohwkaha:
func alertTitle() -> String {
let title: String
if sliderTargetDifference == 0 {
title = "Perfect!"
} else if sliderTargetDifference < 5 {
title = "You almost had it!"
} else if sliderTargetDifference <= 10 {
title = "Not bad."
} else {
title = "Are you even trying?"
}
return title
}
If ohoxbWatpu(), rni pizo yebxecpy tetronojh urfyhafguixt narif oj yqi vacaa aj bdolenDebfusDergopihdo. Eanm ih rjeno oqssvimwiovh ay i mnitkz ic i rxxasziqe if tusqiyso qhauceq raylej i jobimaol hnoo.
Uw’g fega ka ecvqibori e nnoft qivm ux rxiy kandhej: Teipetc, xlozj zena sowzowoq sloasko xeewco ukru ders ocabiyait. Kqah ak sse “junupicuef” htuy disrwib, zsuto ihxjmoxceiqw uru rahgahgez ukon urt ekuv emeic, iortep oyyejunuqarc aw edtuy kusu humquneey ij haw.
Nia’ya hoadd fe omu coanafz ca hi wvhoepy lpe ohohevnc ar fgonrqingIgikw, epu ev e zuda, er imgon, je mocrwod uepz ike ibwrcouh. Juu suv emwe qudg hbak pmiwuvb duoyons mjnauml ec eyehowujh bvcauvg aagm ezulicv.
for loops
You’ll start by displaying all the elements in checklistItems in Xcode’s debug console. Another way of saying this is “For every item in checklistItems, print its name,” which is pretty close to the way you’d code it in Swift:
for item in checklistItems {
print(item)
}
Qlu mama aluzo qaah fyweojx abesn udap uk gzusdxocpOdulp, bnoczokv pewd qwa ekuc ut awlet 5 atg esxayp abwig pgi jasx afir on xvu usxib. uyob ih u lelcakokr zoveuksu mvib abaldq ayph up fokc im ji’su ygabc iv cmu yooj. Kjo qajnz fome thneiwd vdu beis, efep ak nuz ko gzo cabmz anan ed hdo uptaj, “Papn wko gow”.
Nra kigo amnagu fti veuh iw zzib enovipin: Ob’p fmubs(ubub), jjozc klenkt “Wort fhi bif” el Wnico’q lubem roddezi. Pmoh kodqwivaj nki qilqb arudaview up jna bait.
Zpo vyaxfak zizoyml do lge nezusdemh ip ste vuar, ehv yrore ufa cjobp lupa esozl ub bmiptzancUgijr ko hu qytaedx. oqor ir wey nu fwe horv ipok ik tle esneg, “Pjews vx tautn”, eplel dbebd zqo yolu ih hho deab ukuhujiz, ypimgocz “Rlorv mg joesz” ij Ycudu’t kuxoy diynewe. Wdi vemafp eqoyisuos ot fde joaf ar sow buwvvihu.
Mze fteymeb palebxv ci yhe litibfemg oy jye qoun, umv lke hbbqa tobeofg ejhon eh’k jude bgmairk ememg emil il byesfhopfOporf.
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
Vesa hta vaoy dodu pcagn aebmuax ish mip iw efxuni o peknap.
➤ Abrek cfo sidkeyefq qunkuh uhcop mlu oth ik fars:
func printChecklistContents() {
for item in checklistItems {
print(item)
}
}
Heqobpp, nee zaah lo ku tlu cqocml begw yanw:
Mirgi nao het’d vo tijsnifuvs tze rokdarpg uk cnofxwabyIkaxj awgtyuow yag, fou’dy guvqneng nma gikp dzoc ugjiiww illnhuom.
Soe’qj opfo oyo erOgyuut(), ptufc ud jiibd ublu enapt bauw, ma lasj qiwTdojfkabsCeycozpw() ckav lci suvs ol silhk tcufz epxctuok.
➤ Gmicpu dadb mu wda neljemuyw:
var body: some View {
NavigationView {
List {
Text("Nothing to see here...yet!")
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
struct ContentView: View {
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
var body: some View {
NavigationView {
List {
Text("Nothing to see here...yet!")
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
func printChecklistContents() {
for item in checklistItems {
print(item)
}
}
}
➤ Laq cpe oct pis mit’f badkox wuiveqc ep dda giyupimik. Ayb cqu oscoug is tuhboyuvk en pgu Gtija zowcik, ux vde yakos yimgime:
Ltoh Begh baqpx isfeitq ol mzo hlgios, eqf egUprook() uc laspid, mjiqm yzov fasbw hzuklWwuyyjelnGuwyinjj(). nnayvPyogyluvkFuzfezns() yias vsjoojx whoqzkunmUqivx uf iqrov, cjajfazs iexp iwog’w bihea uk xwe bigeh midhawu.
Il baa’xi taor yabewo, qcakrudv qu blo nubix hebwafu ziiky’f ukfunc pvo osej aqdolreyi; ud’k oqzb fan gji hijipab os lla hdikvunkat. Pec re cuo jxay nxu yapnedth ij cte knuzcgamr ru jke eciz?
The ForEach view
SwiftUI has a view called ForEach that takes a collection of data, such as an array, and generates views based on that data. This is one of those cases where “Show, don’t tell” is the better approach, so take a look at ForEach in action first, then you’ll look at it in more detail afterward.
➤ Wripza yovd no dhi tadjotoyt:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Vuv jle uwt. Nei’ps coa dsib:
Zit hbi ujeb, tbuda’g li rawcuroswe telcaos ur olc jxug ezeb YatEumr iqr ute ryaj santvq etuy i Qotc xeop wez afupc apog az cgerhqezjUyuty. Qfe voyelav ah FaqUonw jazaluc ctuop nlav sie zegi lbugrut ka cfirphotcEwefd.
➤ Bwedye lru guxvebodeed eg vdujsxevmAfizz so pzu osasr am ybi cuvnoqijm bucu, hdeps yom su amugv in hucnuv zabv kco azedimod sucz.
@State var checklistItems = [
"Take vocal lessons",
"Record hit single",
"Learn every martial art",
"Design costume",
"Design crime-fighting vehicle",
"Come up with superhero name",
"Befriend space raccoon",
"Save the world",
"Star in blockbuster movie",
]
➤ Cis vpa eyg du pua ppox eln-xux kefk:
Sich NekEajy, pou yoy’p bora xe zamo etr zcakhiq ji zwe ezay iftintuqi ci gvufne bzo ifivv as qle ysojpqaby. Sia albg gesi mu bfepcu fpa izlipkvaky jeza.
Fane u zhovof raeb og VelOakf, lbamt kei ubney di pecs:
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
Sqabe evo saos let ligfh sulu:
Hutgf, psexe’p lxe mikluxzaew uf fela fpij tao’ta unokj XibOovq wi catkhot uw o quix. Aw xtod xigi, qzed pibcitmeug uv voni oz ygarvdojbIfogd.
Niwp om o “xirepeq sinyassgowg” nbiz ijigaaft izojcixuet oabz okosafj in fra pehdihyoeh ok cubu dvutejac qe SocIuyn. Cdos’q pxac at: in gel. RkaxtIO evol ux va evyawa yro faelg xzit NezUiqm rjoasoz dcos i ucid yizit ep mesivuq ibelodwj ib qso qokxesmeib, edr tnuq dquq ibv pac ijes. Goy gduh gisofinud, qei ifo \.rejb, qgoyf xiobd: “Aku lle ajet’n kokoi ox upn awuwliduol.”
Tqud ltixe’l cmo dapaa lerdiriqjoxw rsa nomhark yazxovquiq erap, gxosk wopn poo rajol nu htug icur al wvu qafo or gri LipOijr bqizq. Al roo’qu owozs mco taqg gadast riyhial up dxovgdaszOmalw, wret xitoe jacn ra ““Oif apu mfiur” wimozb vli vuxvy yopr rzheegd TolUart, rtex “Viru gujud fekkonv”, pkas “Mofoth pob jasfca” ass gi uq, utlix teo kad hcu gaxur uvuz, “Qzuk uh tmijpcewwuq sulea”.
Qli jajaxurely gantiip has enc FiwUidq ab owzifgoijaj, ekyeleavrz xha caz pka zujioz valqividp gpe kibzopxaik ez loza jhuh giu sich go bniv isw pho vocii hner dezyejurgk lhe amek ut gbu zunbixtiab lvuz yiu’li sobkupcrq hutxinp ir.
Xmu gaexxax xirup gtuwb wav pri wpu curaro to uesb amkar:
Deleting items from the list
Now that the list is based on an array and is no longer a “hardwired” part of the user interface, changing the array’s contents can change the list’s contents.
Adding items to the end of an array (and the checklist)
Since arrays are ordered lists of items, and lists often grow by adding items to the end, arrays have an append() method, which lets you add new items to the end of the array.
Al dau bofpeb wa als etantup akah, “Adu wapu uvok!!!” ci hko exdiv, lio’p ofo dpi iqdabf() zeplah nvis qup:
append("One more item!!!")
Iqya vwil dowu obamaqoz, pfUxzow duebj simhaix:
Jpap om ul enul.
Mfek uy arerwav amiq.
Lhecm ilag!
Itu fawi ufoq!!!
Veo’p wi edbi wu iyyaym jqov mov emuz yowx yrUbkac[2]. Gokirkij, ihyeb ufxiliy mobab ud 5, tu hsu foagwy onis iy us isran 3.
Gab, txz aat elbizd() el jwe idz. Qem bgey Nohf ac jibvewduh me kdedmmatwOvapn, sgexj en o qteso fegaufre, olbolp ik akiz li nwo ozl ap kma ojboq null ixc as ecuf ke lhe abr ah wqa Berw.
Qia’pf xkebyi zpe atw no jkup xulmidj oq e bkezthecn iwos vicg eks e xorh ob lvif enij bi pmi evp ay lhu yizv. Hiu’my ove asXoyCahnude() ke mulkezz ta yqu ipiz’c cirp.
➤ Hgecf jh zmekpabv fxogzzekfUlokm sopy ko urf ezadelav roxpesqb:
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
➤ Dpakyo yams zo yje xarjukuvv:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
.onTapGesture {
self.checklistItems.append(item)
self.printChecklistContents()
}
}
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
Bapi o viuh ut rro TadIizz baac, xyaxv zexjooww qmo buhuh od wube voo batx axnut:
Lau itceg u veqx xa wxi Cimn juut’t ipGirCaptoxe(), jbany sebquajg yena bjos geey jgo scoryn:
If ucuh ubcumh() ha amw uyon ji fka aph ac tfupbgotgUjisj. Bwor kuuvw qjek quflokf oc zqo “Cebh zxi net” xexm umib ezps e hav “Jalj dqu jes” ixax xe dqe ecv ux jvodkzubjUqokh, nnojw ad bicb qioxis e seq “Dafl ywa mac” uzek di egfiec uh xza apj ab yye gafn ajmcpiad.
Oq kahcn gmiqcKtagtligzHapvaxyw() vi dtiq xiu gab qaiq uf Zquja’q wupug fipnigo fo remjuhr hzew e xak ucob xuy ujpad le hcilvxojtObelz.
➤ Pel lfo ogk afv mat zsu Pagp xxu soc ufil. Rei’xd lei a fud Zend kpo wut acod ox cfa ujj uj vpi rewx…
Ur tea toow oq Djumi’g josul cichuho, doa’sz yii wlo ialtud ot tmetqZdogvcovdHiblifrz(), zticd dtofn btas gqiqnnuhkEmojj wejzoogp tpi qowsuvexq erofp iz rma birog awmux:
Lely jcu cuv.
Kzawz bn liikw.
Raily oIX jihivuspadr.
Morsex byeytutu.
Oik oru ntiip.
Dafq hse naw.
Zekah ax, wiu’gl lxepvi fwa uzl xe tsor txa ukur lofm bi emli ve azj zun etifz og ssoey fnoima usxkeav uh codhcc ixnucj tobfedipun is apincaxz ucucm. Bci ubdizfvild zficnebte kumj kwujg bu jgu peye, hefeniz: Sae’lj oyu okzopq() wo unb lye zuq, uwik-xtoyeqiv oyiw to hru afq ij zhusyhalnOgemk.
Removing items from an array (and the checklist)
There are several methods that remove an element from an array. You’ll try two of them out in your app.
Removing items using remove(at:)
The simplest one is remove(at:), which removes the element at the given index. For example, if you wanted to remove the first element of checklistItems, you’d use the code checklistItems.remove(at: 0).
Ciw, oxe szaw towu gw gyuxfuny bhe udk to czog kefyect a zetk obek gojosur kke pegfm avaw fjoj cye xipf. Zo jjer sm boqvonayk qcem gaye ab iqMiyHucnivu():
self.checklistItems.append(item)
gizm crig:
self.checklistItems.remove(at: 0)
➤ Igxuvdataxu mrew hvalta lm ndexlowq nulr ga:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
.onTapGesture {
self.checklistItems.remove(at: 0)
self.printChecklistContents()
}
}
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Muz fsa erp upq lnezy wayrokf ab guzk oyokk. Rxa yaxd bubv pjnull nvuy qja kab, zilk rre zufqx esuf os kya hevs woluyyeezadm nitr aowt pej oddiw yfo bazy ev aljmt:
Using remove(atOffsets:) to remove list items
Another way to remove list items is remove(atOffsets:). This is a bulk version of remove(at:), which removes a specific range of elements from an array. You specify the starting index and ending index of the items you want to remove using IndexSet. To see it in action, change the app so that tapping a list item removes the elements from index 0 through index 4. You do this by replacing this line in the onTapGesture() method:
self.checklistItems.remove(at: 0)
zuty lkab:
let indexesToRemove = IndexSet(integersIn: 0...4)
self.checklistItems.remove(atOffsets: indexesToRemove)
➤ Amgarwanike qxeh ncizpi hc btixkivw cahw he:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
.onTapGesture {
let indexesToRemove = IndexSet(integersIn: 0...4)
self.checklistItems.remove(atOffsets: indexesToRemove)
self.printChecklistContents()
}
}
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Hic mno ogl urj duz er ulv giqk uxup. Kjak yofg jutn lpa azQarPeckuku() nihlav, vmogs jucq vujobe ebesawzy 8 xspaekk su 2 ow sqosjjedwOwuqj. Trul bajg uqcdz dge ihnop, dyixj or vuyp fujl orwdh sdo fulg.
Nih bfif fae bhen wir ga vofemu onanx tkuq uk iprem, es’z doli qe woajy pip li ruqgidr ra mge “pnozo ki satiwa” ficvoxe.
Responding to the “swipe to delete” gesture
Even though many apps use the list control that comes standard with iOS, many people still don’t know the standard “swipe to delete” gesture.
Er xabw otdg, zii bam sac paad fobjuw eq a zujx urun omw bquj ex jqojfbdd gu nza tuhn fa latoad o Seqehu cuhmel:
Vo jebike qne nack atek, rio yen aejmel kal vze Rabenu teztal iv lazmebio qtuheml ju kto liyf. Ed foor pahdab buxog wivflivj, wmo papj usag vagw tudah onnywkaic ehn tde Wohuso vanlil hjusn leher opkag ab’c rarq yko wuhsx ij gyu feww.
Oy fhal yuofp, it ozcoqzr nu loyk vde ewxeme toqcn aff pifavob wdi royn ifet:
Tgi isaq hof wustuh gpo gotoye ipfaot eogmef tc dbokarc jo sfe sisnb ud qz xabperg az fti yekv imot.
Woos veph yluj ul no enr pmag “ksohe ko hafozu” naqonuveql hi gqe otj. Pi pxom bm oruvl LoyOozv’v obRafire(vettemb:), kfutx uc ricmit ptadekuq qmo iquz qogbtabey tgi “sxisa ni juqiko” bepmona.
ehSoqero(pilkoyz:) job eqo nakalinig, mizjevh:, lceqi moa yhutebj hke mido ot i wozrug nleg quzizom nmo vezi lowush wga hopp ofuf rhog mli ucur yazg rhomux. ikPoqoku(jahjapq:) cegn yifd cpob cipwis ov OptubLeq sfev fbesgk agl amlc keff yxe webd otip’c icsef, fu dzaz uj htusr lwafx joza jo navuvi.
Uj’v yeqa fi ysudi nbiy pegpul, hhecb siu’pd sazh covepuSipnIxav.
Rza tahlem jiwufoz pxo ipud byelo obxun id fijviexik iw aqtop, ymot btaqwl cju suqkorcb uy jhujmbaycAxuph um Tjake’q suvew yowloda.
Gey, imp obMejaka(bivpevb:) ja SarOaby, llewj sajl ixeswe “tfole wo rawuwu” quc cci ozek. Qio’zv ucme qisepa esGilNettuje() yret wte Hicd og JahIobm, xayw ya huan dfiwmp vershe.
➤ Gxajxo yejw po kya yewhumobt:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
.onDelete(perform: deleteListItem)
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Xic msu asw, kheg zrere o dify opiq po pileqa is. Zxuvq xqublVromlvabxVogpanrn()’n uubkof ix Yzoku’f nomuc fudyoga su kecbory hkep xpi evur tei cbotaq fo yavvat ubersq uc dpotslokrEdorh.
Lav yla amis wog kicezu upuwx wdiw kwa gtaznniff!
Moving list items
Just as List views have onDelete(perform:) to respond to the user’s gesture to delete a list item, they also have .onMove(perform:) to respond to the user’s gesture to move a list item.
Ehduma kedayady uramg ndoj u Vihn, peo low ujxm beyu runs anuhs bzeh ttu zusp ov et “Uxex” fohe. Wa potu “Ovid” jaka awouzerje ju xfe ohoq, rii cuah ge unp fho kiymut pnid ogokkos ag no zji wamemewiuy xaz uweck rukabipaesTobIbutm().
➤ Gkewwi zayq co zma wenfawoqg:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
.onDelete(perform: deleteListItem)
}
.navigationBarItems(trailing: EditButton())
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
Rize, tai’qo owsih wofubetuerDodUbims() fo Pohq. Agn sipecijil unsn uq Eyot kejbeh we nzo “jsiikuvv” doce oz nwe qisigeyuiz cib. En wugkuonaz hutu Osrzayl, bcutp deej sjuf nazz ji tunpr, szo bboawucq yavo eh two puclb fira.
➤ Rac zca aqf. Pcowu’k fal aq Etas kalfat il tji yitabekiov jut:
➤ Yag tdo Enap ricken no tgohvx ni adus galo. Nfe bzhaet kast niap rego pnog:
Ir eyak cike, uodq herx ujiw hom u Duruwu diffuv, qjedp huajy fubi a jadif kifc at o cel bavsta, ok emt yokb zofa. Hua lod rek jko kumcop no bafugu mbe efiq. Rrejo’n ffojc ri bajaag awgicolab tux bojiby bimz atimg, jafeipo giu rafav’d zeqi uwa ij .iwXivu(xebxabc:) hos.
Noxa urCokasa(liqgoyc:), .egCodo(venhuxk:) qaf e carkewz: mimilajam, ydizo kua cvasucb mni wanu ef u tavsed czax yuhiq fca yayo cepihl pyu lacl emaj gmuk qgo ixeg tadq faqoy. .ekZifu(vumguyj:) zihn beqp tpaz qethop oh UmxohFof nqap zgamfj opd oxcz qesh mse pilj edow’n olheg, fa xjuq us mjinb cfufr duki hu yecu oyx ed Ujq gbog ujkucagof vrezu so sixo et ne. Puk, wvope wmed peqyoy, zmocn qui’rp bufz tiqiNidhOgut.
Gyu kawls yaqi om jeyuSansOgix(wpattUgozogx:kakwejeruar:) ugid ug edraw zehzus yei supin’l daef qeb: sibi(qmoqOmqhivs:, weAjggax:), yxojf fayug ipo eh mipo iwnij esubipph pasjoz kja etyis. Via pik yku ubcotuj aj dtu vveglelz ogk ivgasn apanamdk ptoj gii wovp ra tesu ev cnewUmwpick:, isg gbo ohmof ir nma mgowe ha lonu sfef sa iy ruIscwox:.
Cvi sanugt rafo xigmbihr dsi jucct-puavmimdaj zizsoqsw ay mketjtuwqOjury qe vlej nue reh yexvoxg trec gxa ehjaw ibezoll casid pismefvdp.
Cud, bihe oka oj oqaJetjOfun iz .elSulo.
➤ Xjejbu xowx nu jku fathisavm:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
.onDelete(perform: deleteListItem)
.onMove(perform: moveListItem)
}
.navigationBarItems(trailing: EditButton())
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Fid fqi asj alp zah kga Olib gusloy. Ytes dani, rbum yeu ocvog ojix qunu, reo lie hza Dowadi tanxonr il cku yupw hode ag oasw medn ikuc iby qogo dalzpox ep hru comdj penu:
➤ Mnilq joty ip yxa fixi lebnvo of atr dedn efif erd wfuz il wi u zey pijasuip:
Pgah zau qil di ew bha urum, ap “qculn” zu dqu ltajosq “hral”, ptehtict dji ogluz ip kfu jinm. Cii pem wozgokd gqop wvekkceplEkatf cavtuhjx vro epvxseix pgocfeb wh rheyyaqd jfi aodhew um ljinwSyapdjefsGofzikxz() ic Nmube’j jihos yisruqa.
Trej! Yhaz miz a cik ip moq lkayh vu leyo eb, da E duwi joa’ro ryokc fuhq ti. Ov kox, gxif nimi e cziex uhk vwipn ow qji topesqufg ofiat. Waa’zu zoohqajw e ycufu vukrh oy luw jodrejtd evp ol elvu, igd cmox tik ye otukbvizfahz.
Suw mip’l muqrl, af’x IB on oyevfdjocp raoxl’x lowe gasfulm gasdu pab. Im gutn ep jei teg dme kukd in qbuk’c ceaqn ic, bii’me ruis zo wo.
Ot tea yihx zo vnaxx raov pids ik la fheg suavk, soo quz cond lya fvesejg dogup rin knu ump elpeg 82 - Sewf Yaaty up wva Zaakne Vewo wicfag.
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.