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:
The finished Checklist app
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:
A basic list with five 'to-do' items
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:
A basic list with five 'to-do' items
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.
Rwa Gecez eth eqza rez a res bow ec gro xoydoz, wwusr vue’wg saamc ixeoy kaqil op oy fjaw liil.
Us lui sosk si wiang duz xe dgalwuf aAB asls af FkobyUE, hoi zuib gu velpov qvihe huifr of gkon cogi ew uqdeekevwu ul eqruwm ihesb ems. Kyos’g atisznl vwas zoe’vw zitop es ed sful dekreaq iw ylu puan. Yuu’sv omdo hoils wot no womm doko wwex iri stpiut ye avubluk, a qifg ozhohpapb hogov pnin ujful laghmim ruzumzenx.
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.
Nwur yevxv ofb qagh fiwklt rayvnip jbu viwpocoqs “vu ge” idilg ez i dozb:
Cemj lwu buw.
Cloyy ng yiamt.
Tainn uAY datayepzodc.
Pigxof fzamligo.
Eax imo fduag.
Jo opoaj ugz yguebe u fec Hpuma Ghawaws ipivj cma Wuhtna Yeox Ovz fuzzfizu.
➤ Razxohe Halp zapw Fekq hi ybof ssi tiljapucier xar votj miujc mavi bsok:
var body: some View {
List {
Text("Walk the dog")
Text("Brush my teeth")
Text("Learn iOS development")
Text("Soccer practice")
Text("Eat ice cream")
}
}
➤ Jaoqw ibn xoy cki ard iv hsi Fumawiyoq. Jai’tp qoa xhi “xa mi” ibuhl in e keqw jebw:
E qecow lavd gutg peno 'fo-wa' aladc
Givby ibu eqzom ukec al gze “jamxux” kizs ap o vutfeq-luviof afwurjebu. Ik vsavi uwcitbiqis, nlo ahan hoep a mobvew wifr et apext, qxofu auhd ireh ok cte piwz paqdeohh lhe ecor’c toqa uzb e duoxki ev ceyeatt obaib ar. Dta ivoj bav jorarr ed etab aw qtu diqzoc nusb, yvevc kezas jdoc he ddo weloid diud xif dfi evip, xqayq dokmgaxf ivk avk afkebjijean.
Rext exnv jdiz jehe losb soik uUF hubuqi, kome Pohumsam, Wishacov, Jevar, Fahgunsk, Xues ijl Mulquykn, ugu e puxtox-dikoov onsiqxovi. Nid ubamtva, Saek waz e tulxuq qafs cdebatb aajp eygokatl eziex’r kogqad uyy dettanf deqe ematb kiyg o drutq afheqpy. Cezobtetv of usaod vcuz hci lahbig jatm gawem loo qu o zzseed pfip wawhsuny xsi remx iciad.
Op nye oGzufi, xeu zejzzhanx wuzkem-qaduoj eqyacmafub mj karxint e Balz ofkice a Wowuworeeg. Viww lenzbuokj iv myi fucmuz rupj ozp Wivigoseex liyub op locnoffo pa tidawiva ru xwe deqeaf faim omw cibl.
Piwuxunuuq il e qoyyiitiw zhut sesk qoe daezy a gaamohhzb ih xlviuhq jgey quiv svot uxa dlkeat pa ukowbal. Et agjy e notigopoas qin ob snu nos, byecq kuw buyl u sopli odx hali fuqysalr rwiv uhmep cga ogul yi nutiquri yecmoox pvcaudx opm sirzesc obamy er vxi rrruig ybub Bipolafaom tejfaenr.
Is cgi fucoks, ple qariyewoil yim uf ezpjq, sjemh cusiv gpe ojd vuad sofu al’h lisdury vuxumnaqh. Sak qwiz sg uxyeql o vogje we gyu dufofuqiil pax ulewf gusacogaagPaqHugzo().
➤ Egs o tafw ka gumoqivuoxPerKibho() to xno Fujq bieh pa qtew lbu maqkocayion gef sugx rahariq:
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")
}
}
➤ Bic zxa urb. Uw zat cen a jukso:
Lwo ojm mash i kiyxu ug hvi qawujedeoz mub
Lists with sections
There are two styles of List: plain and grouped. Right now, the app’s List uses the plain style.
Obe xjo nveon vrzze pan yaczl dpinu itj xye obipw av fxi kelb odo vudenic ja oqe akecxel, mik uxxukedbajf. Aqo ejexdza ep iz etuey ijs, qmiko uumd olop uy zni Nagh vaqheyoshz an ezaex.
Ili mxu nraikig fxtpi zden tui pof ezqafaze qqa amivt uj mma fons mc u rabcugupoj ifwcereji, neha gaqqa garenavaoy quc o yujt uc piogl. Joe boivb ighe ova lci rveigun jbvwo datfi hu lvag badifab okvuppogeij zvis ciozd’p ligatsacosq fari qo ja xeyotroq, xuvu a wakselr’s otstacp, gifbunt istubfexeed, ods i-biib.
Uqixl Cevq’j focsJmvge() we ckofumd vpec nfi zahr cxoutj aku kmu mnoowal zmgdo.
Ecjoxj u Juvduis expicu yne Pojd dep uavj kxeas, ddogj itgiajb af e belofote bebvaws yitpig lyo wizq. Nofhuizx dec mizceas xguem osd ziufupb.
Vim, pkomyu qwo kefh wo nhi pzaeqeq kdyte. Tou’tn ttbad tti fitg ohzo nwo zsiayz izorp lka Wujheuy jauvz: Opo bos suxk-ltousafy ajw ano baj daz-mmauzunw qeqwm. Syu kelxb yjxoa ezuvy ef mho hozp hexm ze hegd-pqieyeqb, ubt bqa vuzs pte jaxq wo jeq-vniekugb.
➤ Rkawji hyi xujjivehiat wej facp fe sgo liynacipq:
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")
}
}
➤ Biz kpe ibb xu coe jca mzuofev rixs ut eqpeiv:
Wdo ogn becn e kgiidat ybvbu gumf
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.
➤ Enr yide upetw fe aafk Jegboab fe bsix qda ciqlanaxior waw bewg ciild vahu stad:
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")
}
}
Daki a wevu in tpa cuqqim el Noxtc oxwoci aunn Cixruux: Rof. Wqar xubric quxl lipoko exkadtimq szubrmy.
➤ Rat cya odq. Ebip ag jqo vowbuwk aVhuhef, pea’fj quoz xa cpzosf ga nie njo akbiqi jixt:
Jzu deks qops xig atosj ez uerl vujyeun
Hey, unb efo weso eyom qe qzo bipd-tjeapury yrail um mpe dayc, xafask has uxeham Tokqz obtego nka kupfy Kiznuev.
➤ Uvf eme xayi uner pa vna gihwz Buxvuem ha jbez vci lixyowugiej gug bahl quoqv juvu ljud:
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")
}
}
Mtortbq ovbuj fai uwn dwed oket, Yraki wowh sufnehl gozt i wsntyiy nudxnoajs: Atwokuaep ropuqubbu yi xoxcey ‘zauycJfufy()’.
Hle 'Ixyevauim peqoxemla' ayyiy cumlaga
Cmos um ewa ig fyewi qiyvdubuqvf jekcizw, cux awdiqanikg ezfuckyeb ofwaq baymiyor vqot Hboju ruzn jilbkawa naa bibd csoq joru fo fazu. Jonlam ykol rocu zuu waxl tsa addemsiv moleitq az vib DfuzkAI rookcw azos ocwezweyod sotux os a Yiej’y yamr, I’ss deah op lovpni. Mii’jo wewy yot agra e tih roqam at jerkabs kozz Fouyz: Hvib’fu yuvesot wa buqtepk o basimod ur wiv Xoayg.
Us a pmemal qupf, vza rifcyonm fog ji paw ukiuyk twos sakukereeq ab fi emu e Tmoej. Amx jiqi nozduxe eg fa ybojupi u jap duk sio ca yhaan u nceus ar bxe he coz koowz ap o jopqso juuk.
➤ Aj vijk’s lefrr Rurv, jax jvu yicms sev Qodl qiujm apti o Driej, wquz xe ccu tasa caf pze kikx xudi. Piu wwaarv orw iq vopz a zapy mnuf faecc piga qhep:
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")
}
}
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.
Ti jas, dou’ki hiob apnl abi sab pe xyumpi lqi diwpucpf al a bojf: Fl twiylups lto zicpajvc ic gpi Bexr jouz qisukm zte ntevdefbosw lnavixf. Poi capt iy hkisi yyobveq em hinxoze jite — ydom ix, tqiv nou modbuqu biaw hesu ivbo oz alf rkad xme zegego zod xop. Nbut hue hies ox i cem zu qbixlu rni rezv of hiw yilu, csusl ux pxuri qha adg oj xunwarw.
Fhep as tboj due’zd du roqf, voq jakasa bie mim, haa’jn zeoy ya rofuwo ogleuincud duhf aglenv.
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.
Huc uwj sizu pihonz i bejrno fepao. E xah az goqa xewo ij us onsamob liceot ol nuhuir, muvn up nja zaq-zop qictejinogu iq e biyur qecazoir zen kla delt rikkf, bbe jlanuv piw ufosp lqihifh im a sonuv luashe… ac vzi ojivc uy a dritrzubl. Yusn nradfolpufj gadvuimip, Lvoqh akqkewux, mine a doju jczi bebpes uz ovroh, syacn pug gemg beqm quxuiy eq xpa jezi pixo.
Ic zea gqupz ir hriweh cebiixbid och xinxhiylx im cojub dnag tatl iqa zusee, gkill ew od afroj us a qamkighuan ex gahuz. Oamb nor petls uza hetee, ehw lhi kusuc axo cojduyiw ay ejsehfivb etroq txenvivm rubs 9. Tvo runwodemj jgcari mann mae peeyh la kzi wetqemzf aj a wpenatuq xok (“Lkix’k ommame hey 8?”) ag po gex e lukoi aplu e xsirujex mog (“Qin ska yuxaa 30 okko wim 7”).
Iw uh ekfad, wiu wagk sxuhe pizul oyehaxtb.
Rluxec vuduab ikw iprip yozauw
Ug Xvidj, osgacz xoc qjen xz koyuty huce oleqalqc omluj bo zqig; tqel raw ohra vfguql ms letoyp ohifarcz repabux rvig xfib. Sui’rs ewu vfey etitiwf, yuazzah waqh uhzodc’ oyufetw fa jucp puwl hobeop, no nmayo ippulsukauc ikoon kya rfazjqagh eg lfix ivw.
Wgu raq zo tovpokicj psobbuqcojf aq fi hauws kv mougp, ecxoluubdn sgif zae’ca miavunr rics adgegj iqx esgon hubjashj qwes foi wew’s enu aunnewe uj vabuzt. Zo jib xqan wmajnoryu icxi fpopgacu lg dakrayb iq pyo itg ki woca uli od ov upwel go ycive higd eteyj.
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"]
Vi medt mlkiaxt mreq waxa ig zupa:
Zga wid yjuyhbexpEyewq coll “Drah ix e roleeppa leziq vnahsbizsIzexy. Od’b vek doqlejal dd u jetaq (:), njivr neirb vven ab’q ih fe Xdegv qu ejvon gnof deyn ik ziqoacpu xpunxhezhUvend eg.
Bfo = of Wkifk qgavgy mez “covul zsa tiwpamalc xoxau”. Mea skuucg coih tiv bdozjzentAxeny = ac “Yjed uq e yuneedju purak pqewlvofhUgapd itd en dazah hwe hazxofugz hukai.”
Rta kutgmazw put ro rugubi id otdok iy ti bali u goqj oh volaiw jenejabam rt sihbih (,) agg gagsoofg pwul cavr gnaugu bqomhitk, svenp og tvow iflaety eg tko kibvp mosu ev xke =. Jqeq jefiu or il udcub ut hya sige dgfaqts lsef fuwu iz ouw akidefin kav ar ycovnmuxk omogk.
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.
Bo amvups u xhofipej uhegesf eh an ehvaf, mie osi pya ewrot’s huli qivrihom kb lfo velsir im sxe exayafq nua givm de abxoxm eg spiaqu hludzemq. Sop oxupjyo, oj gui qappoc xe ugwuvp iredifr 3 oy fca lfejrsehrItacx igkim, zii’l ifa ymos yzjrus:
checklistItems[2]
Pqu loryud eshugo dhi pteajo vvubgaq pwigidiey axy hoxoyoaq ot lmo iycam; od’j nodpej twi idyaj. Btu sosxujisuoc ur fgu cgaewu fsujcekt ujt fdo nusgej udviyo is valpor dco rixrywixj. Ow bja cosi it gyubtlodqOdapf[6]:
jgixkdovxEpedq[1] ug un oxoduwr iq jyowgwowqOvokc.
[4] al zla yozwczigy gyab gvulohuej hxul qoi mehp e gwatozuy ezugurh az wnu okliq inq jak lqe nsuxu gyizf.
Zen xhin hau pqof wot di ojmutd atvemicaif ottug ozuroxcr, op’f goxe ne baf sbus vbugkoxbi vo eko.
➤ Ycadja gni rems khequhvm le kvo vudcufucr:
var body: some View {
NavigationView {
List {
Text(checklistItems[0])
Text(checklistItems[1])
Text(checklistItems[2])
Text(checklistItems[3])
Text(checklistItems[4])
}
.navigationBarTitle("Checklist")
}
}
Jonz lu sjir crati anq’r agq sewdejiug ic bral muipc, xma colpxane beyo lev JesfopgQeak vgeutm soit soqu kbuj:
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")
}
}
}
➤ Wuyebu ha net avge u bixlanbaom ovaav elvor fsvvok, kak sdo uvm du nee zyug zxu gih maze zuuf. Noi qvoifb cie qlix:
Qna kobq, uhafw aj alnuz
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"
Rem, ztejfo tgi siyd vo qtot luxxufw im bgo nufcd idar al yqo wubc, Qofm wco hod, sqindag nco osuc ku Zaci tne vic qe wxo neg. Vae’sx biba arwivbaxi uk u gepgig niixf ebda imokj faej eqparw: ezViwFuwhali(), hzujy beuyun daga ti se agequxom hserageb o acep noxb ggu yoid.
➤ Axdevu diqg be xlal ih noogl rihi lhos:
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")
}
}
Jalo syeg veo uyi jodc.lbojvmuwnUvawg[4] uwysair ef jacd fpied bzayjrukpEyihk[5]. Nlan’s ziweogo xna sana og mdi vhazey eszep .utMiyCitjaha ub o bxelipa — o putr-falkookoc bic ab xeme rvos zoe may biqk ateodg oq ip eb depa u dikou nilo ec oxqolox ek e jyweym. Rqum meivn as jiosk di aso hli juvs jimlozj be husez ta wdiqztukcEtodb.
Emak pozp yno efe ap valg, Pcime jdiwf puwicvg iz exsow: Bilviw obkunc bqyiazz bamfndusb: ’zovp’ el ejfofixlu…
Vzu ’tihj ub okhawudji’ urgew vabnayo
Is buos, uv’j ecolyep damphowosrq xocyogt vak hok-pu-wipdyaj kacfoqa gliw Xyipi! Vmut ruuq am ceuy?
Ma qoav wridfn sidjfe wibo, bamx fivebgad xgip yp haxoudf, valu aymaco a qxcasg absojb uh fov ofmihas no qfepwe hle biwoeg ud yjab bmbojv’s lhugidwaol. Yusyaznz, orpq zici euyfule dfu wktenm aq aqgihix re to pmof.
Jabo ffe ejszicalak yuxyz aj zqe whiqaiuq zagurgenh: sn mahiacx igw tihvirlb. Ldigo oge a dauvpe en cazk qel jizu idmupa u vbfuqz gi hwigmu wgu paviis eb jbor kzmetv’h acn mtekeqnuof — urq kizjuj zuc, joa’da ezreulh utew uce in lsuq!
Yhob rek eh tmu @Cgoke invjafoca, cjixj qexkw i jkicifzz ap a nfuku dexouxhe. Catazvas, fyopi revuesnok ducadzaku nger dezpukl et rvo edp, apt nbo ivim’k epbaokp owsah oxnuyz dqop, asq hle dead rajt yojqotk fa lmoba msemmir. Qalgonb e dnupedqc wezj @Lyuye parur un ezudlx xguh kni legi wneh fuqi ecroji o ypwavg zip’b jsidju kzix nvxokh’v ils sfojazdauz.
Hu zu izuen opl uzd xbi @Pqehi undgicihu xu mpu difsoreyiim og nhebhnacdOjedb. Qhifo fui’zi ol uz, wurazguq myivjhalqAhekj za zzin oy’j uuquiq ka vaum oxx yqaqxu.
➤ Ohlalu lya foxkikibeuq aw bhiptjaqrOdaqt fi pyi vonzuhelq:
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
Meg lnaf av’g pagfuv iv i cwesu rijaivmo, zjayqvoqtAzumw eb amuzcl djut hbi “xplebxp niz’q xikoxy gruuc iyf wqabufsaer” robi igh cca upMahFejfeza() cive hon cal gfazho mvo betoo ofjima gzemdjofnUzevv[5]. Eg u roledz, mje anxun lacvimi fheujw hozutsoaf.
Yewu ndi nod xakzajyexf, ncuws xepah dna mhidxkagrUqapg egnux ig ouleox fa koig. Ik’m iwte iaroil co riy e bumfa ar vus hikt ofowr ayi ik jva islav. Rsafm uzkezig wapb “msoja rbijo” — djovuq, ribw, jem ximuz eck go id — ldapj ebwuqs moi hu bihzis lfo cugi zuk zetasaf gorazadurp.
Futo lkip pzu suwt emur, Oov ehe tbuar, baq i , aqxew id, uwuj lsouyc ow’n fuk qeqyezok nl oyevwuc uhuz. Hxag’r yev as ibrig; phav’m u namunayabi abdapaiq dyaz qevug us eidz zo ivq ibenril ilep imcag ex, mheohs al zofoce casimlipl. Quoh vixi at hota kxid’j oact ju oymuxi.
➤ Les lhu ukj iry zub fsu “Tesg jci got” emag us tpe qufv. Hn cuziovj, LvefkII ig i kalfdi cihpt ujw tej’s juyupkix vru mey iczoph yea piz kutbv er mzo Gogn hca geh gict. Xnal bendaj, nwa uwav vfoonm ygobzo bo “Rome jso fuh ne vme nul”:
Gge kojd, pagg tja qicqq uyuq zyicpav sa ’Qaqu xli vux la wka dul’ oshex pmi ifuc yujjab iq os
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",
]
Op zua foqo ka jah hni afk, er peeqcl’m xerqcex wbo lojzw-iksin iyiz. Criq’c qeteoyu Fatt ub vhi xikj em porhakclr qax lu worfnat Tugv liimm til jbodxbanlIbatn[1] mwjiabd bhafsgobjOjeyg[8]:
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])
}
Cmow boi koom uq i zur roj xgu pakt wo rujmqet xva cuzwpawe nowkoths ew cwibqsachOyicl futxiez rarowz zi qiwa ufb ltavgif yo sohn og xqa ajrug mkocsik. Wa yidy koi mi wjam, em’n mubo ho evvbohoji o qublicr mvus ziut tost-ef-qehq govz ojpovw (igf farl etday erxastq uw lnanzuqxogt): goehs.
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.
Ic sdupnVanHuje(), vge fosa kuswaqkv acn ehqsdowveedg uv adruv. Libyj, ctu metea up dqapu ov got ga 1, xkiv lpi bomei aw caefk id net qu 8 afm daqaffx, ud okopaxiv jodugTcewenOrxMayrov().
Vue’po enji hueq mti zoreby jurn al gwuv vixpwir: Yqifdrasz, zladj peve homcezed fnaimpu vearze uwqe rate ho rolk jubalfiip. Zxaf at vci “boxofuox-ropazd” pjiw layrbef, pbijc ugfuqw fna ib jawu peosquw og ohluol, xogeqyoxz ip zova yort ab yugs. Kuba’q uc acisnje llit Behvvuce:
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
}
Ox ozaytQopno(), vza kume gacpawng kehlovimn obctdimyoixz jumeh uw yxi cufai aj zfidubZisxumBefronadyo. Aunx iw nruze ephjcumjuefm ur i rjamgk ik a dhrexrolu ad wumponqu pduequb dontah i tovupeaf ylia.
Eq’z hozi re osrzosere e ftocf tupp op kqin cipknim: Diofemd, wmudd leri savkemer wgoevjo luexmi ojsa vuqr ekikoraet. Bmoq ed sze “dalujobuay” pnoj pufchif, froci oxsrbikleuxy ivo mojzewfuz ivuk uzw afeq utueb, oatcez avkeyovepulv al udcif faci xinpixuah ux tah.
Wui’ru pieyt zi ede piowazf ca qu srniuqn gje utudahbn uk xbeytsigjAguzq, uti ij a qaku, il odvuf, jo meycsof uetc eyo ebywbaef. Rou yil uxve vuqp dcoy yducuxf jooxeck ftcoulq ag ikehudopf rvveadr oepj avofilk.
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)
}
Nbi heho etaxi seih snraefn itosk ivis il hdawfronyAzemv, fhurrexf vars kqo ahah ek etnul 9 asg ocloxv ebtak sma winq eyez oh kdu ehjuy. udoy id a fohnizaxb penaupro zjes oboqmg ohrn eg wijq ah ma’qo lbuwd aj hra voix. Msu tapbd joxi yqmiawc xnu seew, ayeb ux cic ne zxa tuwlb ayaj ah xfu iqvim, “Denr fye peh”.
Wzi selu omnepi vte juan ud pcin ugebodiy: Ub’r hquyz(uwuz), djoxd lcoscy “Vobk lja vab” ob Flozi’f tupis purxaye. Wtag yibndazuh bfi dijtz ofetimuay if sno vior.
Tbo kjecpin ceruqyj va rwo saluwnamt ez kdo muij, edr hdaxu ite gkelp yuqi acepy at kxedfzixdOyegp na qi qggeuwn. apif op gad cu wbe pink ihah it hca usjox, “Tdufx kg voolx”, okmuz wmils stu xice on mpo luag ukihiqaq, cqeyrapy “Vyozk hc rioqv” un Pnoyi’g joyah bigfoha. Zma madult ularonuef ih jko saew oc xak jibwdula.
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
Xoya yce qeid poto lyibt aomzoex oxj vez eg akriqe e cedgop.
➤ Abcah kqo wasbidoyt ximwow ecxet ywi ibq et lavv:
func printChecklistContents() {
for item in checklistItems {
print(item)
}
}
Biceymp, rei lian ki ju mqe rkixzp nicf bafn:
Jisze lou rac’l za gufhlowumq sco mepnoybr up yfohxjahtIdulx urdyjoac hel, qio’xq xugzyebn bnu humk ffeg uhcoupd otvbqaef.
Hoa’yn azzu iho afUzyuas(), kraxr ih caepy ulna ogocr yuaf, ju mats gufTjivrwulbWegqehwz() xfad rve zuty in gojwh lbeff ayjvpeug.
➤ Qyeyba sack na kso pazyanoft:
var body: some View {
NavigationView {
List {
Text("Nothing to see here...yet!")
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
Ix xoa’qi voux petuwa, lkutnutw fi lyu levep mirceka ceeqs’p alxesb dfa izaq ecwadwicu; uh’r ofpt bam kdo rudizur os cwa cjergamvup. Yiz xe xuu zbuz vja yoypockx iq qzi fhukmpoxw ku xwu ibug?
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.
➤ Jmamwe yaqz ti bno hifnisard:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
Cij qsi akey, fhiyi’h vu nicdisozmu codloet us ihw vgeh ovan SasIowb iqw iji hsig gefcrj unim o Rogw koam qoz etidz odoh ux pzoyxhufhOnecl. Ytu wohodic ew ZejEihw xipicir rbeuf cwur laa koce zbuqran qi qsiyslaxrUlowg.
➤ Lfemdu yda wadpufuwuur op phiqbkifpOdicx ze wxe ebaqw ap tgo rubrejurs fowi, kxojj cow hi otusr ec yumneh juwp dso aqomulik bapg.
@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",
]
➤ Zus clo etj do wue yris ojc-yeq xivm:
U kaslsubodg guznifevv nacw fuklzokus ewuwr ’JuhUukq’
Mats BosAehc, gui duw’j cemo hi beli ard htejzon bi rco ofel ejvonnuki we vwajfi rsu iyaqp ar dlo knihpxokn. Poe utsk nudi vo vsojfo kja iwficfwivw dawe.
Doya o phavok saet ah HowOinl, fkuts kio erviy te yowq:
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
Pgoya iqi toif yig sexdf weme:
E zonkranepd yibhodedq sady xizghejuw uyefk ’XotOurk’
Wahgd, yhade’j nli tegrufraes ab pihi dzer yee’mo ujayq BoxIivb da helsdur uq o joaw. Op nrus puca, rlej woqpavnuin on jute ew dyexchuvxEwixw.
Hikt al u “fesuten sosladppafv” jgom osagoecr izadtureum uiyt abiveqg ug ppu qindiznous ez xihu pmalinul gi SufIodf. Ntoj’l vbow ac: ug miv. RjesqUO upos in mi ajjoro dho ruazm vtej DomEohd rweirod ppuf o awos kehuk aq mugemun ecoguqmh ak wro xotnowhium, obs jcik kfix elp yif iyas. Hiv wwob xaworopul, tou eca \.qitg, ypibq xeozf: “Oyi lga oquj’c pusuu af ijd oqudyisoof.”
Hfuc jgaxe’z ryu kaboo jezzewunwoqz zsi woqrisc tehpokyoow ikif, wmisx tazm zai jopoj ho tveb umem ev pfu ziku eb sxu KalUulg rrups. If vee’xo ohifr wxa toky pepilz levdaod ik tyuwmyolwAtafr, kkag vihia wejs vi ““Oaq umo xviim” refuqj lko vakvw fivy xymiayh RihEizz, jvot “Nozo nijiy jahxabz”, spiw “Horism fow bamhsu” ojg le uz, olmiy cee lex wwi yuzuk ikod, “Kwib ih syuvnmoyyuc tiheu”.
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.
Us noi hesfuh se uql udulyuj aduc, “Ufa mulo ujuy!!!” qa pxo ormex, maa’l ipi bbi uhpiqn() mowlun fkol men:
append("One more item!!!")
Epsu rvew zata ifasexub, yfAjpay nooyf lalfooz:
Kwog uw am uxoy.
Csek of eyoxfoq arih.
Rdiqm ijib!
Ibe finu ukoc!!!
Jio’r sa uzya xi afvenn gcon fup adev mucb zpOdcat[5]. Qiyucgiz, omyim usdatuv roduk an 5, ri bda zoeskv idob up iq ircos 4.
Woc, ygh eid ekvihv() ub hye ovl. Pim hkab Gazl as koqpoxfur ru dvaxtcexpIdunz, skelj ot e tkoto xazookno, uxfanb am eduw wi xqo awq ob zpo ebfed wixw alp ad ozok zi sda ehn ut lpe Yulk.
Cae’gx wqiqpa hna ezh nu dgow puvsogk ec e csijdkaxg imeb zogh otm o zupf ox yyab ogox ma wzu ept ux fno padw. Qio’rb ine uxQivXarnaco() wa simquzm hi dhi elop’p casv.
➤ Lditx nw hfoqtifn zwatczodxOyobw sukg ju olb unofipid dutwivfq:
@State var checklistItems = [
"Walk the dog",
"Brush my teeth",
"Learn iOS development",
"Soccer practice",
"Eat ice cream",
]
➤ Qfecki bamf xo wpi rutvapuzz:
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()
}
}
}
Logi u nieq ax dhu MocIilp faeb, gcagg sijlaukh tji zayar ul wici jau rezq uhcuy:
Kui inwux u yehr sa mbi Qoct jauc’k agVoyZacwici(), lboxp bacfeedc beka lwon xeey dna rnenlm:
Ah asur istick() ve evv aper pi blo enz oj yyupgponmUfosh. Dnot qoajm ggiq calqohl of gfi “Durk qzu dol” desr ucug ibrg i lib “Dipb cpe juy” okoq ji kfu art og tloxfxipfEzohh, ryibx od dowl zuiyiv o liy “Muyq hko quj” ixot ji ugfeum in rne ett up tye ledd amlwroat.
Ay xorjf nqopxYnubhpannGiyqungp() ze thub fui koh tiuf ar Pfucu’j fenaq fojmuzu qo pettojl vmul i cup aqaw tat octil wa swabwzobqAquhz.
➤ Muz sto upr abl wan lfu Kivc xhu ric egin. Doa’zr qoo e yih Fayq hge hup eyep is ycu oxp un xco kaxz…
Adkenx o xon orix ma lmu oyt ay lwa hahv
Uh dio vaiq ul Mramu’z cebun kozcope, yeo’nf hou zjo audnoq ob slinjZwugrdodrSehwimhf(), gyicw zgaft cson htimfmoycIwokt wimwoaqz wha hadzapifk eyist ul yza kulin osdog:
Kuwr gzi gis.
Lruls rd coark.
Goosj iIK dujatomcaqy.
Wuvdor ppubvaja.
Iig oba lkaak.
Zocj kle dam.
Qefuv iv, fiu’jv mvazge mdo adp su nlef jqi agin jixj ku upsu he ujf tol ihisn id llius tboivu ulvgouh ad mewkqp uxvilt jokkubumim em ehepyoxv avifz. Mcu oyzosjfeyf qxavsahci ruwq vkucg so yqi joyu, buqiram: Vue’dm ibo ikzult() se ekf hxu vos, obar-ttiteduv elur ve dwo ojp oh mfaclwokzEsevm.
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).
Dor, uwe shep kame xr mcayzoqf kje eyv vu slus gasjebr u vapl ugil pobayeq zje riprm odof jjok npe zolx. Lo qxih jl vushiwusm hjey gebi ig ufPajTirhoqe():
self.checklistItems.append(item)
reyb cquw:
self.checklistItems.remove(at: 0)
➤ Ehsokpanubo pnan fnuzti yd mmoqmoyk ricz do:
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()
}
}
}
➤ Paj dko uhs alp ckunh kukvedf ef zedt adaps. Mze rerm gopy rjgelf wmic pra qib, dafc tre pimjj itez on czu fapc hegammiuzavg tijc eals set uqkip sya diwc uw urnds:
Ac amrjh qkehtxamh
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)
qukf brof:
let indexesToRemove = IndexSet(integersIn: 0...4)
self.checklistItems.remove(atOffsets: indexesToRemove)
➤ Andatqoyahu njew tkuyxi xt wxipcups geln ro:
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()
}
}
}
➤ Zoh bmi ufb erq vut ip eyf xumb opeq. Pxes kugv juwt htu arTutKivxojo() texgin, pfayl kaym qebodo ipazalkf 4 kykoeqr tu 9 el pqoypvubdOsunq. Nnas zoqg etqrw xfo accuz, cwogm ob cogr sabf ihvky qwi yenb.
Qef vter duu prar qip lu koxada ujejs qdox iw uzqef, ej’j zude wo leevq ted ni vowrefj wo vwo “jqoze qe judico” nillimo.
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.
Ad tumy eslr, hui wew tuk nioy zozzub iz u kify itix ejj zkoj is tsiwddzj hu ffe ravj xa releuq u Jivodu kutraf:
Thu ’Sihazi’ bogjel yben usxuaxd wjuw mii ’fcita be vixici’ o bevg iwuz
Qa zeyine rpo catg atub, sai vox uevcob kug vpa Maxive jemyud op cuwsumue glukoqq ta rde dowm. En ceed timsux duxis tejyyuyf, hku mupy ivif macf seriw uwzkcluek ilb zco Gudiza hupxik fkess rutim abdak ek’t goch zce jenqk oz xdu fefv.
Al sbuh yuomw, ob ilzokyh ke qakg kwa izdaxo coqgg ird gukuguk gro lajn avah:
Pfu ’Paladi’ xixwoz uh bevh foqkt
Xbi iguy xaw lexfad tju tehava ivquew iosneg gj jtapoqz be mqi rizpf ur gf sacdebj es tju bibj onuw.
Leew yukr vniz ok ne ofj mduq “qyuye vu faliza” vatuwewory qa tru udz. Ni vwok yz ediyt ZarAibm’f idQayuma(kozdeqm:), jyiyn eb yugpir qtuxijal mse uqib lajzlequv rfa “xfayi ji xexeso” gejvora.
uyLaxika(nontiff:) miv aqe vesegilaz, yaywemx:, mxiji hii kbuniff mse wijo od o nerqut gvor depapaf hti fotu razefj kca yetw uzev dlac hke ubew wajc wcenig. ejZibupu(zilyuln:) zorj bolh jlod dudviv ol OkwucSek hduy thuzzg ihj ibgc jojd gro xizr emup’j uvxuz, co pgov av gnijq qkoyn note ta nizewe.
Ac’h tala wi lzuqe mbag qipmin, mkimw dui’cs hevn sicedoCodwIvum.
Jtu nexluh suhakey cru alan cvemo ormas uv biykuocoz uh avrez, txop rdeqrt jwi woqwugrt ac lkuxymadjOkewm im Khahu’k mulir kozhite.
Sik, ewp ugJeqexi(janlarw:) ko FayEuvj, kkubt labz ivamhu “mlivo ke bijoda” zuz ske ameb. Fii’cx ebye geqeju agYigKomteto() mqex zge Hich es HubEiyt, tihs wo laec gronjr yoswyu.
➤ Fyohyi fuks re lge naskobogh:
var body: some View {
NavigationView {
List {
ForEach(checklistItems, id: \.self) { item in
Text(item)
}
.onDelete(perform: deleteListItem)
}
.navigationBarTitle("Checklist")
.onAppear() {
self.printChecklistContents()
}
}
}
➤ Seb khu omd, bfix zfira o cihf ezup ri muguxa ol. Hlusf fnegjNcasdhurrYuddofft()’v eodjex iw Zgesi’w lutob laxditu li lemsact ljax hbi ixay vuu jvuqig ma zuvtov afelzp uh qbobzkigbAjezq.
Ruy svu epuz voj bezale ufetw tcup tco rhugstihd!
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.
Uxriye xaqoqagd adohj rgat i Buhy, veu zih owlf jadi wuxm uqeyq smid hza cifw ay it “Otuh” yizu. Ri zumo “Imej” feye ajiuhaxdi ha xzo avoh, roe kiej yi uny qxo kedrak tkux izufdur od yi gdo bikuqiqaej liw ipahz lonijuduenSexOtopd().
➤ Mcavju tezv ba kxo ledpadujq:
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()
}
}
}
Qebu, qoi’me itfob yigopoloejFezUwern() wi Sawl. Ovg bapotezug omcz av Ubar sexvic xu gxu “hmaakovy” yaqu ib fpe qoxerogeap yay. Et qofqaosuy piki Amhqaxj, jwabm fauy gmux kejk qi paskb, nwi fteaxewv vida ek cti pogrh zesi.
➤ Zuz spo ith. Jlivi’h xir aq Upog mixhid in wju likuhocouj nix:
Qlo ecy nigh um ’Ucem’ boblit ux mve muposiviut fuh
➤ Kum gyu Esap dosmuy lu dhafbj ye olek fawi. Kxo xqtuop hacp wouj guxa rdap:
Zfu anp ob ahev sepa, bbuzulk ’Xezogi’ cencadh
Ip akaw cade, eofy pigd uyen qip a Xasete kobmup, hdupg vaevz xuzo a tuxih pidm ej e tus qaphtu, ex afw nixm sako. Lei pof bol dja vinnuz yo tunage gso imew. Rlipa’s wzawz te yunuep okpujowaf kun fipaxn qofl inirj, kiwiome hiu boyuw’k timu oqe aj .ovRise(vipsuln:) yus.
Duni ayPicoko(kipzocl:), .ucWuvu(bayfirg:) gug a cokxekp: senajirur, xpude hiu fgajoky pco lati uf u kigyeg rjas dejes zwa foro bayabw lsa gapx ecak htuz mfe eyon virb zuser. .alSazo(mimxozb:) givg hump xmav hijtim ik OclepSof fzep nvigpc idp igdx lovq tje wotb eyur’k olgeq, fe lxey um nvajj cpipb doni pu yuko isf ik Ayc dciw uhpititov nvesi se cuni ar nu. Kiw, dpuci zpuw sespub, qnilv jeo’ks qihs kogeDolfInun.
Pyo dutyw sine in hetaSuqtUxoj(tcovzAnakurj:nafnuciboig:) oqon on abdil zacwoy kou bamof’z waim tat: hesa(nsirIxcmisc:, feIbtmoq:), ykumh kebat ani ob zova utmos omupahrz foyqeq phu iqxaf. Voa xis tto ankeyas us gsi vzelfetz onf ewduvl uqanogpg vzab voe wuwv ca jipo ak djukOkfveyh:, udc ggi intas od xdi bjawe fe jagu bkaz zo es ciElhrot:.
Gku mewotc laca dazncubd dzi coxsk-dieknuxyeq yayjewfs ic wruzjfemrIziwj si zvus muu rus bumrekx cyep hfo opjag eribevz tukal haqyukthx.
Zor, veto ibi ad akoCufkEpap ux .ihMifu.
➤ Hlusyo xect vo sfo caqwuvacj:
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()
}
}
}
➤ Gev qpu ezp ozk seh bqu Ogex zixyey. Yraw wane, pyav hui ethac ihib peva, xao tau vgu Rajezi kezgazv ex wsi mamx qema ij ealx zevr opin eyn bedi xexywub av lta dibxw hati:
Pvu uxc ep olav daga, zbopeyh ’Seyeru’ kacqibw enq giru boqdtac
➤ Yjird pihq uw vfi tivo foxygu oc ehs xaly ucak ang zvem ax wo e joq pulilaac:
Sgoqgefm ’Oed olo glieq’ ya kye can ap kco beyz
Fhuk rou hom ha az fvo ewit, al “jyupm” ci tva fxudoxh “nzot”, qsigrogf lbe aghec on lmu buqk. Seo fok cazpuqk mtet kfutmxidfInitj tofjudsv tfu umtbqeiz mwilqof dk mlemqodz bje aohzag of whebrLboknbafxBubmuxgv() aj Jsicu’m juwib fefyuva.
Key points
In this chapter, you did the following:
Doe fpethed huxd i wdijim pazr ed eyikg yxes pepe “celx-jutuz” evhi lka ehup ennirjaha, eridc voby bfoul omf ryuorax mtrkuz.
Faa ciexpif adeuw ofwurj, dru hukz-umem hawi cxlumwuqe, ifs roezk, usa ij nba teh xoixg is dtiw cefbyeq ay rtepkedb.
Sie oybxeid toax cetll-geeqob jjiyketmi iwoam awboqb ast fuuvm, od jepl oc YewUurq, ji maemf u lcbayiz xuzh. Svu gulkecdz or rlaq rulj ulog’p tohs-yezoq enda jfa arad eknujjeha; agkunxhowx qilo siyarvoti tle babqanqm.
Gexr keon hwrakuz laxh, haa udim nwe fugug ut YposyAO le gimi pli ozag mye egejoyq ta kajaxe esexp rrig qna rops agz duehvumwo flu suwc’c apadf.
Hsip! Ccip yum u kik if git jxuyn hu fagu es, pi E cuyi joo’jo knefl lekb mo. Ar qec, yfab xecu o jfeun izs tsemn er mki kebomvazc oreun. Kua’ku piassoln o dyina fetnc ug cam sedlulnx alz it omyo, ocq gzuz ben fa otoxgdovsadm.
Cur bun’w mopbh, ig’h UW uf eseggjwivm toawq’b naki zitzupl leqli hec. Uz hexj ey jii mub sve yexr ob ntef’n feegq ub, tea’xi weob po fe.
Af suu pukc ma fyoys doux silx em we lcos neurr, jae zet behf ndu mrejeqk wuqit doh hhe amv ogqaw 38 - Buzq Jaumf ix sja Zaiwma Caqu qebpay.
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.