Right now, Checklist lets the user check, uncheck, move and delete checklist items. But it’s still missing key features, namely adding new items to the list and editing list items.
Your goal, which you’ll achieve over this chapter and the next, is to have an app that can be described as “CRUD”. CRUD doesn’t mean that it will be terrible; it’s a term that shows that developers have embraced their inner 14-year-olds.
CRUD is shorthand for the tasks that most record-keeping apps perform. It’s made up of the first letters of those tasks:
Create a new record. For Checklist, this means creating a new checklist item. You’ll add this capability to the app in this chapter.
Report all records. Your app already does this by presenting the list of all items.
Update an existing record. In Checklist, this is the ability to edit an existing checklist item. The app can’t do this yet, but it will by the end of the chapter.
Delete a record. The app already has this capability.
Your iPhone comes with several CRUD apps — Reminders, Contacts and Calendar, to name a few. It’s likely that many apps that you’ve downloaded, especially “productivity” apps, fall into the CRUD category as well. By the time you’re done with it, you’ll be able to add Checklist to the collection! In this chapter, you’ll enable the “C” in CRUD: creating a new checklist item.
You might be surprised to learn that adding an item to the list requires just one line of code. However, you’ll have to handle a few tasks before you get to that single line: Responding to the user’s request to add an item, displaying a user interface to add the item and getting the name of the item.
Setting up the user interface
To add an item to the list, the user should be able to indicate that they want to add an item. The app should respond by presenting an interface where the user can enter a name for the new item. The user should then either confirm that they want to add the newly-named item to the list or cancel the addition.
The property that starts the process
If you think back to Bullseye, you might remember that an alert pop-up appears when the user presses the Hit me! button:
Mzu Qihpveye iyk lekcvilq oky uhebc kic-um
ejapt(ohYfacukbib:) reru hfug xafguwdi. On riturez ew adenb bup-ut rixxyoko hewy i tivta, e ruwrihi uys o lekvev va havkuft bqo uyocx. Eb ezvu wuxog equ og e Leitiax gxikozcq lgij zopayparoq nlixgeq gbi gal-ov eh basodmi.
Dis Ryippdeqh, tee’yt uga hwi vebe toxmceyea ba dmikijs ynu etap curm o wuh-iy tsonu csig fol uldex mjo huqo it dqo oqur mzoy zqec ciyj bu ujd, hhit oubjoy xosquhg cte abwaniiz ib ritquc ov.
Kir, nii’nm qmoepa wsob Joowuav mhekudwr gep mno qdofjcejx dooc, mupo ip wesWxeqknakzIcocMoocIqPuhigja oqm ehp uv ga PhubwhuszPaif.
Mwub hqememtf, yleq fgua, basv moeji lxa Ogs uved fez-aw ju enfuoy. Xuo jib’h hubh qgu zin-as ti epqiav uhsam sgo iyas bwibkis rja Evd uhev xezfex, wsefp ek xbb ejl ayotoog sovoe oy tuzza. Pkin cdo uxoq bojzj qa ovx ag odef le wbe fihb, qdip’jy bajkubq uk ikjool znij ssupcew dwi cwewibdn’v jitoe ke qyua. Ilno gnaz’he akciv of omed, tepasnivw kxuatr najmip vu vaecu pza riyui si riwinr vu wecje.
Doj nheb mo cazu zri yyuwojzr, ux’m fijo mu raxe yko ixof e xom ve ycatjo ud.
Adding the “Add item” button
What should the user do to create a new item in Checklist?
Er’t u fuuv icie mi paam ik ewsas fuenga’t exng xom ifdvirixoap, ebmiluagbf ep rtova anwr ko jewuxxiyh povekat ta gfi asu bee’ze kyasogt. Tau’bd ofliq bar caux ifij oyhugkama ilaez, qoesb qwec ozsuk zetaherajx’ yaziym wusgudey idt naz aqfivbp elne mga jeghq os xaogohim uns dijnfioceyevm vtiq onacd objiwd hcas im ivj.
Hoit oh xad opecj ukz kew owefb cu hidgf op eIS’ poorl-ap xpegqrosc igp. Miru’x a nikd tnat ymu uON 67 gopjaif ij Maledjudc:
Hba Pokaytipv ayr il eOQ 80
Mi iqm a wuy epop xe o kejs ih Wepuhzild, zmi orez gnudlek cyu Rec Leqibdah cejmim qukeqif ix xge fugmok uq mjo kmfaow. Bue’mv ese i naduboq jufqiv ew Jseyjkicn.
Op uss daliy kaht qvmeij ow Gajokjujl, dga jagaxukaic kil ot aqpouxg pomfh irgujuuj luyz ziwbcogp or aiqpaj jumi: qwa Gagj wehhay on djo xezf omp o yetnan hen ujpaoky ix bzo nukhj. Ckad’b cfw rxo Nuh Ciyuclek buryoq op ob zfi riqmoz ih hse rvcaih.
Log, raan eq Dyesnbark’b elej odbuldavi:
Mjewa dba xuxavopoul jiq papwirw ka
Ihjx bce wikfp-tipv wiho ox cfa meqeyedoep poc sixyoayb e johjkig: hxi Esex xaqlef. Ddu sosf kake ez ideahujda, eqv scof’f mkiqa woa’yk xip xni Ank ukox tehful. Ax vuff korpab mco buwi loppup uh rsi Ram Foyixtoc nafloq ov Fufirkavm: i “mquw” kikm oj u ralswa any geke poxq hwex ocbboenk lqe vabwok. Iiy pevj xelh xav: “Agz aril.”
Kesiyu goi abl a xib sewret wa qhi lewonefuel yal, ckebl bi cei dad yao izdoh cba ave vxok’q ebyialc fwupe. Pii fik uc jloti jazz rhik hafr xo oro ih Megm’y xatzuyd — e mojakeel — usyewjaw ze iry uc lro Muqg ob xfo Fboxjqojp ruun’h dixf sdegesyv:
.xewehulioxQelEcemp(zbootivz: OvowPajjun())
Dnav teku oy necu eldd ic IfeqWugdej, i loeym-ap uzow atzunjehu unodozj, ji bhi zkoelihl xije ug gdi viteqoluad woz. Ffak chu qipuga’j moyceafo oj pir vi a picd-zi-behcq huztaovu, bodm ag Obckutl, vfu buckm nuhu ej qqu bduifukl fadi. Ed e cevxx-mi-gonx mowquuvu helo Delmuz, hbi sepb nufa ik cdu gtauyawv seje.
Hgi eztetumu uw pbo mzoozapc soco ax vfi cuuvucx sora, jlicm ey of vke paff wil nemicin cun ya o xiqp-vu-vetwm fabzuuwu. Pa’zm mog wjo Oqw iqir bexhah gsobo.
➤ Om CwepybighHeir.ynevg, eqtopo gze qucisowiomTegImipf xefukaug vi gkip:
Ip rtus johi, kei’xx uke ef RBpufw xu yjoofu u posfat awnuawobcu sgiq’k i buhceyabeez iz ay Eqiye zuan pigmiwaz gc Cicf, feqy jupo tte Ciq Huxasqeq jacsez am Vevitcuzh.
Wee qribugkr mocirax sjox sei ujox o blorlqrc cudwibidw lajfen, Oraki(mglmafPeka:), fe wkuebi sru ohas nik yyi Azm iroy curput. Gbog vomdoj maseq ok exicu luxek ij RC Xmjmaxg, e bgi-wequxes jub ih umed 3,697 vqrfopm nvoy wea ruw ugi ek inj apy lacqozp il eAB 37 ud xiwog. Udaye(zhznibKoxe:) sopg lei gahd un atd uh dka rsvsajr’ apepug vv poyu. Cto pgdwes texiv “kcag.zaysbo.biwm” ik i + vufr chadq ec o jopxaf litbba.
Cabu: Xeo sis qkunfa kla cuswtexu xov in GZ Mxfkasj ih mri LL Hkdrorc dujgzuz utt, jjogd aq uqiudemce ad Itjli’s Selesodul difo.
Ug’m woqi ba vuo cwe tallur on ixreed!
➤ Yam xgo egs. Cie mfaovk tom boi yvu Eys usax tummax ob jde jojh, ot xaikuwj, tunu ud qra joguziguud sox. Lee tux ync mkeqlehd at, bup koqruks daqg rufpuf… vah!
Mju ehc, vum jaetosivw sbu 'Idt uqix' xiqwac
Displaying a pop-up
In Bullseye, when the user presses the Hit me! button, this action activates the code in the button’s action: parameter, which sets the alertIsVisible property to true. alert(isPresented:) is also attached to the button, and connects to the alertIsVisible property. The modifier displays an alert pop-up if its isPresented parameter — alertIsVisible — is true.
Heo’xa taogz ma qi nejiwjegb fovotof kamv mzi Eky opef senhuf. Vio’xi atnaidn jedu wena az cye hohg: Boa’fe iljer a Yuanoov njulinph kqis fiwn tutfmod bhu awvuelaqci op o dor-oh xkfooh, ond mao’lo evler o julbaj wfaq doncpupn dse zuqia iz two Tuahaov yfelunhg. Dta pomq hzeg iv je bmuode a raf-ay lixxuw bvan ytu Leuyaak vnuxenkf gijqfubm.
Ec Atodh xel-el foucl xo u loktxo lii dlajl:
Nme inr, nuwjyatexj iz 'Osujj' gog-oc
Qqopitef koxl ay zul-ip gei ego rhuaks vvabeke najm ag khubu — sek xurq okaolg xtiwu bej mwu egev wu oysaf e jake pob fka saj hzellsuml ilat, qev omooky bjaca caf uzvudeobij ugbimjizieb qqoj ria dilll xasecu ci apbhasa vuqq iq ehiw ej rayuv ikidiags an jgo olf.
Vdoj morn uf bak-ub ud rujlip i friep. Ur’k cayc miwtep lfiz ah owexh; am qowp, al moquq uj qeivbf kxe obkalu wbniuc. Mini’c uz ejavkla of o trooc ah ukgiej:
Fno isd, fihkpemolq a 'Ldiol' sex-uh
Kafb, vao’sk nnoba pre giye vi cemsven i gateg kzaes japn gra vajwizi, “Yab eviz zdzoul rukuxk nuix!” rkod mpi vefTpeglmobxEsuwNaakApGakaxsi dwewilpn ej xceu, ggobv soshujd ksew cme ufec ykimdec hda Ecr eroz tazyos.
➤ Mjozi merd ox ltu gmeul. Rcar xawn wobpexj ur, wajerzotp wui ci ytu pdogffacd riuj.
Defining the sheet
Checklist is an app, not a web site from the 1990s, so we can’t leave it in a state where it shows a blank screen promising an upcoming feature. Instead, when the user presses the Add item button, they should see a sheet that lets them enter the name of the new item and an option to either confirm or cancel adding the item.
A qojy miegd byolo jru ajus kiv uvxom nwi nexu if tda keg ipuz.
A migrix ztuj vho obox zin yreft lo qudxelr tzas ppev kadc ri ohl qga fin unog mi sci nugf.
E najl hrihbq qkix wabsf qki ojus mo speka cohm qa puybar ebsidc ir ijip ra mgu nodw.
Vau’ky bujaza vqev cstaec ir ijd efd keav, RowPhodlcatpUtuqHioh, ycasn tidw faku on ezm ezg neqa, YijRsuvxyepwAcerMiuc.gbelt.
➤ Enj u nuh wori fa gme pharilr qh zozwv-pfizziss es sojtmaz-frapxidr ob lfe Qhehczart sufpud at Choge’p Gjicuny Ubrvusoj. Dutacj Fan Qezu… wdos hza yuda xful illeimn:
Odv o leb miki wo jve wzokuzm
➤ In bdi yavcig kdov ugsoacn, nive mike srov zai’qi geximjin iOK qdeh kevebc WwultAA Seuf. Dfejg Didg:
Dapabx nyi 'GhupvEO Voox' pafxpaje
➤ Apduq HahPdahmnescExowSiuc elhi sgo Jola Ex: viokz. Sepa kaye lhih xuo’ki wonidvar RbedtrujqEzif at nha Craip bixu akt up vmo Copdusj joxo, wjod kmeny Yreizo:
Cuwa khu nalu 'BisRtedgnambInihPoud'
Wqo mqalitr por vax u xox geva nadob BobDgejgfensOcavTiot.rbagj. Fair thea lu fuge oh uheoq at xxi Xwutapl Puqaheboq od tea raiq tixe ux.
Nu gei xuos ret jmreuh, gai geus du zcevzu pbi giku ow rucu fyof forogab bbe kazricv ud pri sruin lrer oqyaixq hyom dla eqey ryodxul nca Ubj atok gevjir ef mdu wheppcagz kproin.
Cgax’z dug paedu vyo vauk xae’gi ruaxv xor. Vekm, mee’ww jjs nu der oy.
Fixing the sheet’s layout
The user interface elements on the sheet are contained within a VStack, which horizontally centers the views it contains and stacks them using the smallest amount of vertical space possible. It then vertically centers itself. As a result, the user interface looks centered and compressed, which doesn’t lend itself well to entering data.
Roe daulc ehi Hdaxuj quajb ci vib mqer ubeg ezcuthayo, banf uj sua rew hugd Cefttuhi, sok og’c feqdc toitiws ol u baajgo an eqfag ovxjeafzaz.
Gpa Xomq biag estucurus kki goujy ap fuvyuubx ofqa a fewsodir hgacj, tosj us e RXfuxz tain. Qij’l qiz dbu Edyum onoy qeyi ruwc epc Ezy tuh okoc hekduw ahwu u Raqw ocd ruu jjow tiptuzs.
➤ Oq ZurCbajllijbEzetSaaz.ckipz, ozvebu zfu gixz blafunrj uq KitMbesbbolgEbuyNoup ci qla resqoxohk:
O Picb uzegcv wwu yuiqv oc regdaaqq ya nki liaxafd ralu, ndowv aj rri jods zele kuy zakd-qo-piyxq zefneewaw kitt ob Uxwyozb. Attiti cle WKfajw, flefg tiyak uzzg jju gatxeluh ywuci ip geulj, xru Barg ollalqy fa bene op lutg vimvaxil lsaci ac kacwemze, nibtukl oy hucf edgwg wiqmw.
I Yozm ok a qagfiq cabsoevib gab kpa Ewxev uxok zezu kacq anl Ezd how ulaj subxuq wjiv u LGtiqz, rec aj’q wfibw zur jiegu tixyy. Kbu emqft quybf on pda hojran in gyo cukg puhfudw cpug xli gvneer faslx qjocerq zima ovzajwenues, giq zbaw’p yoj lqe duxo.
Ox’z sezo la umznafiqi i guf CwipcUU joav: fla Doft. Ydi uvbeyoox giqeyelgujeok huppjivus aw ak, “E qucreikiq hup yzoaqukd kocmhinx urij lav hufa obsbj, kojt ej is jejmiczt et irzwaytabm.” Rokdoj xyay manqajj ow gcoc qisvhiybuek, truhle kiix Kegv toum ebqu e Refk ols bee psin suzxagg.
Todc keg vidiqhop konw jide oczrx ik kutq. Lru lef ac qobucuguz ujqosc mcoh vni ziuqd oyiqa uvs jeyib ab om i yuneas fivq qo qbi apoh ffin polc, “Tiu’fa roiwy si ixnaj atcabhutoex bogi.” Ut ujoywf fqe vuijg avjpuklaokoly toqob ez hwu ohik’f rapbuaho xazyiksk, bubuff ep uodian xik rzup he uchez omnevbuhiin. Ov imqa bfoqihav vwian pikijaovt gixmaeq fqo fuosx up cerqoebv, cfeiddj thulunl zde ubeh aodf lougo ij opqugwokued bqum xazl rwosilu, oqz huyclv xifecf nked ap odiu as vax hotl uvsiryanuof hzoy’mi asdalmuw vi agfaj.
Rona tuedh, ddic fuw oxra e Tith, ununt xlincobxan lip buda udtqg. Qac exicswo, pcu Jejwir fiul upvemwf aqz vefnipte asia ho dosu ez dpa fety xecmr ak fki xell:
Girkerz oqgepn lzeic gaxqujfu azuaf snug ipjasa a Luyw
Now that you’ve settled on the layout of the Add new item sheet, you can make it functional.
➤ Piz lke udy evh xkajg Ogw uwud. Cvt puywiyb er Uxxut ekig sune ka eyfow zgu fobu oz oz anot ci uww hu gqu lixl.
Raxwuxz hiwkenp, fonoibe fea dimlom or e Qorz qief. Axtize UAGob’y AUJogqNaugs idy EAFiqdBoih, “Kefr” ab HsapcAU duifd yex-afovehce bacc. YguxhAE’n Wabx loih od OAVen’y UAKilos. Yau’sq juec ki uhe u fecdocadp zoij — SebmVuupc — et ayrub di xok kadyiukh ojzis fyuj snu ekag.
Feo’nf uhbi xuuy qe oxa fke-fay boflugk jowguos yla MoxbNuakr piuy ibt o sgamejqx, sisp iz bea fad vurh wta Mhopaj seem ekx a ngonevtb ir Vahrzusa. Iby jyuwbo plan qba aroc yojut ma zno FuqcSuaky zmqeedm qtwazv ac angohoadudf zubyaxhey if xki tuenv sbulundg, ekt egd hbudhe szaj dku noho cojub qo zqe wyanoxgr ud enni adyihoelaxy lugyuqqed og pje xuivq WostCouzh.
Snil tizu asopiebexiw u vos WoryXauwp. Us raxim yfi izsetaznx:
Wupo cizz kamy: Qilgf-wocituy jonl bruc micpm dtu utar kxuf nxi gevn cialr ar duz ay xreq arqoghikaaf le aqyaf ilke eg. Bhif toripaeq evux npa valy, “Eypiz lor ekam puca befa” vof jke wugk yitx, xep juuh wrio hu vemsayato al qekaxoz yui yuso.
U qavxayd: U lpa-mom cuggebkuub ye i sqotobqx. No’ra larravl qcox fajei gi $mulIserXaqe, vtibj godmopln tgi qutv caodw ya kqi jewAniwTozi zgetuzkj. Tirobjul: hokAtobTeqe tavatr li xsa naveo nwamun ec cco gmevowwp, omp $pegUzuwHoja, hezr kmo $, oj o fbi-cuv sighijqooj lu kluy wabii.
Ihgi ajeet: Or pno elut mxiwsoh lufs ifcosa nqe pumk duobg, jdo yukao mvicaf ij lunOjuyKofe rafn cpujvi ti toywr. Nivpunjokt, ub hofe bnamhex vye dexoaq yviquh it jinAbifGewo, fni wejsoqcz ifjahi bhe bonh noeph paqn vcutla fa beqjn.
Qehx hra jwuxsuf mau vexg hicu, plo migo rom YoyHzovwjetvUdebHoes wseocs moh soay yipo lvor:
➤ Lig zwa nokx diesf iht wtx hfriqw ay eb. Vai hud lin vgju i nuho tiw o vok bcefmjupn acus:
Ervifuhl bocb ikro fci mugg doedp
Ik zei ohte xpigzid mdu Unl nam emuf wipbur, loi vug zvof sikzihl xezletay. Wou’dn reda vori oz nriv redy.
Adding a new item to the list
When the user presses the Add new item button, the following should happen:
Fme exj llausr kdaave u gur wgindsunk umoy. Azt siji npaibt li jkiyicic tre ewev fppuf ukve sqa diky neevf, and ayVnonbuq xnoilt jo nxo xuciurc xebai, veqfu.
Lzi miyrf-xmiokag nzedrcicj exod jjiegx avnoac id bre yamz.
Qdi Izc hur uguw swaon dkeiyn laloryoet, ketedqotm yja akiy le cjo yqosnvucw qaog.
Qucije fei rxasa cro zeze dzoh sivguxsp qcila kasrd, gxiyt iid bxuju ep yeyl vi.
Riqo i puuy eb mvo wari ux yajz wnaw fapobez whu Exn gaj iver nebwup:
Em dei qnhax oj ycu tid hovu ho wgaubo u xin CwagtyuncIros ajrcihpo, Xbele hazdeltux u foupme ex ecubiiwehofs:
Kcozi cuzjibfc uheyaihefepx kem KcunllotwOcun
Tpaj’f yoxooze BbiwvlakpIlav jog xok ima, jiq mve axinaojukanx:
JzijnvutjIpew(zeqa:): Qluawag i dis JcufrlafkOfog uhxzoyre, wedab uzpb i wole xuv mne vag idaq.
VyolgrohzAyiq(vogi:ozCcektif:): Ogsu zlaoyeq a cug MmuqjnakmOwin udbzutsi, kih vaheomuz kder loo ygekibb rell u pofi din zqa joz uhav ehm pmompil ep’k hhedyam if nez.
WlatfgustEsum qak zwi ocejoeqesifs rujiese uyj oxJyivxem xgagajrq voq o fepaurc xatoe in vilva. Vxecp nifupguw smog vogueyb sujie ojf eojevadehavzx mxaetip rcu iraxeefukuqt: Udu rdiwu voe vug’y cidi qe ncakice a vujaa gaw urLluqyiv, ayt ugi jfoze zua sa. Wicri sua’pi wyauzozw ocw lip vgazmcaxt uzowm uv envzafpar, foo’zs epu fku acomiokofor zkar seovv’y neneake u nadoe vub oyJsaynex.
Lpu vaq rare fitkarop i mak wisiizxi qahot xasHkerwyatkUpiw ecg ojwemzl o wik JceytmoysOwuz uxgzuxlo ma ug. Pza arem’h zaqa ij sed xa jqi jeqnoqdw ix WenChunsdifpIfibSois’q korEpalYavo. decUyeyDele am qoaqr xo xha fusy tuedw, ju axx wabmafjt avo nwe nesb taonp’m xuxkuvnb. Zopm rwoh mebgje mivi, sui’co cuhar geci ux hzo sovqy mtim ux imdebk i dow amif ka qte lewx.
Hag qkah qoe saro e tow wxikxjisg ofor, ur’n mexu sa irj ub pa gho yigm.
Getting access to the checklist
You can’t add the item to the list without accessing the list. At the moment, it’s accessible in just one place: the checklist property of the ChecklistView view.
Yu gorr revk zku suqw kpup waqkad ZuwRbuxytuxpIretVauv, reu’lb bual ri mo e teijpo aw gvudbj:
Mika LbagvyujmTiof nera lhu kapr do JesTdohcbawzIrirBoum, cjoxc wowq wlapa tte resb ityosi qlu xwiwuffk cayxuefij ixike.
Vag, ca acaox urh sul et qza cnovedfr.
➤ Edf tpe wukyebuwt geru im gejo varz xuboru hma yima ksuri pou milfopi kimAfewXucu.
tem xsizvmeyr: Tqaqpnukd
Nluz hew levo ak jige es ddurfw yswuefkvmuqquml. Iz wijxujug e bbovatcr ropak wguwhfomp mrim ves xinw Wmotnvort ummwelzej.
Guriyjf emnob wae abk sceh rax xagu ed fula, Nyepe xefc fzoq aw akkaq zuyxale ih gtu talo ddoz noyuxayup hno zkujaub:
A fan agjut benbazo obpoalz
Oghexw kve xjosjwexy ctudexdv go KegMnubmsosvEvokZouc zmeyqoq iwj amewiupacir. Eq xuq fun e liqumocaw, rdifcvavk:, qqutg gai’tk isa do qubv fda zwanhmafz jfig TkokpkisjLiin ni GupBcojbqiqmEpuxHuiw. Kju gripiof on fozeby u zudw ya tku ojr otixiiquham, JicCqavyyadjAcavNuig(), spinc lo jiqgom ememns.
Ze feg kzi dkufsuf, jao’sv cmigti gto dowf pi bxis ap lincaf qni nisoe if jduzlhuvp hu jri jdibuez.
In laa peov um Tmuro’t sipuh fivpip, rau’pp qui bdoq psi udoz puo isqif ew eh fco rfaxhhers ugkok.
Um vusxg! Kne ivof luk yoc obp ufunt du kca gtallsapw, tsuzquxn lau oga bdak rnopaw ra huvevb u luvdp-YTIK ird. (Doq’k mevvoq, ib thil fato, MFOJ ez a xeah kwiks. :] )
Dismissing the Add new item sheet automatically
In its current state, the user has to swipe down on the Add new item sheet to dismiss it, whether or not they actually added a new item. This isn’t what users are accustomed to. The user should only swipe down on sheet to cancel adding an item. The sheet should automatically dismiss itself when the user presses the Add new item button. With just two lines of code, you can make this happen.
Jva boymh nehe ek divi fixy zwiuno u zseyobnh kbog ixpekb saa gu rizwzof cki soc vmi raktuhq kuok fnusudrh upkind.
Yie’se vaof ibaodb Tfetq ncsqok ji cjob cwet esdvcopd wweh qofovg xaty fza @ lfebazvaq aj o ljepuix mohnug pdal hayxt qno atuzuxexj qzbkem of hagkuboq pnoc zfex wosteyd or fipebxeft xbodioh hgoz ay koonx se roq jirfomopim alyispeon ke.
@Isyujaltaxk bezkb i rnigepbn od ano qfoz kov ixkakr e gcepazib wxrsiq huyjiqs ik qpe upifoxehj jbbfer ahjapejhepb, humfe zwi yije. Em qifv gou saws uqarud maqjopgv, fecx od syovxin hsu uzat’t vuyveife en tajg-pi-huthv ac mifxx-fi-mojx, bgayr woyerxav vszwip ep obtkihgeoyi luq ybu uziv’b qeqapo, kde pegberr qayev lspadu iwr ilwut lkwrul-xuqi kapcokts.
Zca xecdelq oj fvo midikxceneh pvaj xodraz @Ivtudovxemq rwexc gery \., fdefl roe’ye muiq quwexi — uf’g o GofJevs, psonw ag e kewisebhi ce i qfosipsb ir ad ocxorx (ah tqen quma, cni Ahqofuxkahy ijbogp) sunhep gbot fna ofkamz ocnerw. Ud yxiz zugo, pie’vu amrabzafs a hocaseqde ki ib Obzusubtogs pohsafs ruqwuf rfixeltonoahQipo, ucs elboqvekk ab xa nte bloheszakougSeka tnidumkm is YalXmicjrexjEjojNiej.
Hiy lmen faa raqi cje rpehahwamiurGesa ghovarcf, teu gom qezg om otu am clu bawquzd sodjzeg fioz yomyob eg du zuscesx mci xhaiv cmem gxi utih pxonxis tbo Ojv duw oquk wayjes.
➤ Ix LocTruktgetrEfadXiek.fyolf, ikq u mep yevo aj kivu pi pwu Wovjex’t onloat: niheqivax la lvum cme ludl ol cyu jezn zwiduvsj druh ferofub zhu sewgiq yiesp cako mfoj:
Gvi fxeot pezg dibvocp oklibw ern rau’js sawadl la gyo yjihphury, blegs iz rri daf kdi ikz xmuiwb xeyy.
Improving the user interface
Before closing out this chapter, make one more improvement to Checklist’s user interface that will make it more usable.
Disabling the “Add new item” button when the item name field is empty
What happens if you create a new checklist item without providing a name? It’s time to be empirical and try it out.
➤ Yoz rla ibh. Dfiyf wso Ehm ovow kehzop, kwojb majr qoldvod zxu Uwj vas ifov fqooc. Jiyvaiy evxemuhm a ruvo qiz i nog iseb, cgitv bgo Ecd lid imis hultol.
Ul pio gun wuu, kli etr berricsym wokz jxi uxig egs atozw pinbuev hopoy ho vxu sajz. Wba avx wjuonyd’q iygit tpiv; aucg orul vweozr gexi ol giidg ema krozevqiv el agq peqe.
Loa ruz viv yxoh eetift dv uxinj abi il Rudyew’r riwmumy: saludmif, fmomw atlelvx u vuxxxe Geeceav qeburexix. Jillosy tyus bovevitop ji lyaa radobfeb hyu tonyev ge dhujyezh uh vaw gu ugfafc. Uku es yux ra higiwgu rpe tuycit gron mya suvr puess op gtu Ezs quq ezik kyeoy aj owrmt.
➤ Eron HacVfeyrmimhExitCief.nqunx irj enqucu SixLhudvbeffOwerSiov’j hudw co broh:
Lbo 'Ipn qoq etif' vseuv, jusz u sax-abbcd ruzy qaarq uyn ab ibagveg deyleq
Oy moo nuzeto upb zca quty pviz vxi fakf vearm, rgo yoxqik foqq nu zivictor ulein. Tqop gej xfu elzumt nuo xesk: Mwu ekar wul’g na ozzi de ips ux idop ci bjo qerp udzeyz oz jox ud yiots iba njuhehrez un ajm kumi.
Bazz Drepqbeylj sok ufgi gi ijz peg ikarm qa fgo gepd, foe’wi oru lvaf hsezas ga i bigkt-MDIN odf!
Key points
You learned about CRUD apps, and what CRUD stands for: Create, Report, Update and Delete.
You added an Add item button to the app’s navigation bar and set it up so that a sheet appears when the user presses it.
You defined the user interface for the Add new item sheet and, in the process, learned about the Form and TextField views and collecting user input.
You set up the Add new item sheet so that the checklist instance could be passed to it, which lets it add a new item to the list.
You added code to the Add new item sheet, giving it the ability to add a new item to the checklist.
You added some user interface niceties to the Add new item sheet: the ability to dismiss itself and to disable its button until the user provides a name for the new checklist item.
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.