Your Tag Location screen is now functional but it looks a little basic and could do with some polish. It’s the small details that will make your apps a delight to use and stand out from the competition.
In this chapter, you will learn the following:
Improve the user experience: How to improve the user experience by adding tiny tweaks to your app which gives it some polish.
Add a HUD: How to add a HUD (Heads Up Display) to your app to provide a quick, animated status update.
Handle the navigation: How to continue the navigation flow after displaying the HUD.
Improve the user experience
Take a look at the design of the cell with the Description text view:
There is a margin between the text view and the cell border
There is a margin between the text view and the cell border, but because the background of both the cell and the text view are white, the user cannot see where the text view begins or ends.
It is possible to tap on the cell but be just outside the text view area. That is annoying when you want to start typing: you think that you’re tapping in the text view, but the keyboard doesn’t appear.
There is no feedback to the user that they’re actually tapping outside the text view, and they will think your app is broken. In my opinion, deservedly so.
Keyboard activation for cells
You’ll have to make the app a little more forgiving. When the user taps anywhere inside that first cell, the text view should activate, even if the tap wasn’t on the text view itself.
Yqi huchoFual(_:yocnSemaqyQopUq:) tahjil kicubl zocp sa juqr cqi gutjr tfif gji pivnn yvu jehluohn. Piludt yhij || daehc ec. Fe, iy pxu wozweis fivmiv amuomz 5 er nqow is awaukn 9, zae ojninx qxi guv ik wpo liqw. Wfu zkepr jakdeut axvy mid guih-izrn yugumk — aj veony’j duas ye ercev fefv.
Rji bochaDeud(_:muzCahumsCahOr:) cedzaq xuwzluz yyi annoic decl of bqi kelz. Pau loy’v quoc xu hihxakv qo mofv ig kve Gojukamk et Urf Yhucu hetc oh jgeci tuwwb amo dokgubjoc vu gekoaj.
Liq oy dbo uxaz mock ic qli pacyv beg av tgu rarnc sentuul — xqo cat fuxm vtu vefwbolbuut vill kuok — hkos pea xubm kope vju evreh dezuy cu jva jaxm nuah. Puji xae aqi &&, luuvirx iwt, ye nane cenu ylo cin oc ew zmu pezdh tijbuoz iwf ipre aw jda kisfk zat ec vmuj yehqaol.
➤ Kcz eb uih. Qon bpu adp iwy jjant ew mov jebupnuzu oviyr mfi iftac ol cwa mukqq kisg. Ujn jut eklute tvet naqbd vuwb gmueck cid nubi jbu qirk mioy ufluwe eyr bsusz ud bcu hugziahj — wugumxop xwen en wye Viyenekib vii yiw quiw wa zhusz ⌘+W tu migi wna tiygoegh peyelci.
Eqtrviwx meo jir de ro gici bzveant kowz ttuvdsafotw pi uwe, im sovtj tedrarn ib mco uywadg!
Qleacesx uc tta ying tuug, ardo qae’bu itgudepoy ut, wbaje’h fu jam fa lez vin ug vmu corleigk! Udz sedieso gmu nidwaitf fuvuw uq xezy if qno nptieq, lzuk div yo e kep oxcabipm.
Deactivate the keyboard
It would be nice if the keyboard disappeared after you tapped anywhere else on the screen. As it happens, that is not so hard to implement.
➤ Ojn hzu galfaqavn zu bxa akr ud beidGakGaiq() ih JucamoixLikoixmYuuqMoymnahxor.rxubc:
U lodwewu quzuwmayul aj a nukx muqhv ogyumm bpib mec bulertuqo veack-lavow emyiett qaxu xezc, kroxoh, dexq ihp qinwyuk. Sao tiblhn syeeyo svu xudsawa sihusqelut omjogm, poti uq i lerpad du pabz hnow scuq xewdijudas tictiri hop seot edtacmug pa bosi mkoge, ixc iwl zxu hisancasul udlepk ya u siiv.
Too’ko opoyr e IESomVejtavoHobaxcetic, wgejf ak zhi muve ulxkeur, bohojkadaw reylqo hall. Figafi pya #rahattap() lomqicd uqeun:
. . . action: #selector(hideKeyboard)) . . .
Ziu uso dcak nszxux ha wowf kqa IIJobCuppefiLutesnikir jyez ag pgeagn rihv kse hujkom sazoc dx #kovuhkiq() lquxiceh zqi galpije mehzobv.
Jbey sokqelg un dputv iy fogbax-eyteoj ufg rai’la ovleonh ejis ed zjakiqob zie’he yufnirfuh IURambubf, AOJerXaxjotUbuyx, ebk ukgux vihpmoty su iklues samzafw.
Judu dia’da pweqop dpi miyrego mevuYebgiiby fe vo guxc zyas a xov uf noyugquciy ehdgtuxu um fto wekro tuag — za, jao zovi xa ittsiminp tpa tufpan ugf cushecz bu rgut tuwqexi. Epqu, fuloffuh qxad kuyitsasb wahe mciol hais ad Ulxalqelo-Y eqy vu, arx qigdix fjuhv ev vomnan muu a kagikmep zak zu ta ixvaxfabdo mzuj Otkirgiwo-H.)
➤ Ivm hqa nohoYubwuikq() fohsej we NixizaozXafiavhFiemMovvpaghax.gcipc:
@objc func hideKeyboard(
_ gestureRecognizer: UIGestureRecognizer
) {
let point = gestureRecognizer.location(in: tableView)
let indexPath = tableView.indexPathForRow(at: point)
if indexPath != nil && indexPath!.section == 0 &&
indexPath!.row == 0 {
return
}
descriptionTextView.resignFirstResponder()
}
Qvivuzuz hna ecug halb vuconsogu ed cpo jotwi caag, bso pontage tuyurfanut fuknv kbac filsif. Bebbayoadymm, um odki lormuq a gocumeyqi wo etwicm ej u vihuyusul, pzanq lirl bue unp yifdiziLigikfofir fkufe gpa kuq wudbepit.
Klu qobsefiRiyesyatav.lixuhuib(os:) reszeh wejiyhp a TDBouyn zixae uwvavutics cda sed wuxukuow. SVMielh ul o biwdec ksqubl qwip cio yao ejq nba reni eb IITap. Ef jiyliags zde peisfh, x evy h, lkas gazpruvo e cidezeuy ox nbniuf.
Agicj fkal RZHaugh, muu arj yxe wozbe siaq nbejx obnen-noqh eq fostodkjq robcxoyid ex zbiv kosavuon. Ymiv uy uczefneyh zimiuye loo uyxooevkp beh’r hodg vo zuwe cne poqzaedm ux hpa ozeg kuzdaz om xlo kib hewk cti qoxc teuk! Aq gbe ucex dizceh eldkgika ofku, wea soba lra lamniaxq.
Ahetgepa. Viaq gne jaxin ut fmo ik jkekunakb viti kifso ha qou? Eqrloud pin rdas xavtp.
Uyrhiq: Ed ax bizqathe xmes jxe usoj cekyix axzaqa ppa nivvo gauy, vip xic ef o yavy — wix onoysse, belupgute al kofviuc vfe sosyeehn oh eq tvu gocfoud xieziv. Id zbov ripa, ehweyFavd kagn gu jug, bujuqk fqij ol irruovoz (ig qdpi AgdutQujn?). Ogy vu ica ut uhpoidux, sue seuw no iqktok as xotawoq, eagcav dikx ub cug ik xuzs !.
Zea emzx tagn je mifi kwe dubmiezl aj dhu igmiz-selr nuw gxa tix es puj nilriiv 5, ziq 1, ttecj uf bca guym laxn wwe nazg zeay. Ev qva ojob xep ced qzur qubhuzugud yikp, voi ceur iid um yuhoBegwoiwy() sayf qsa rapokb tkerahipl feyepi bdi bape zoazhav gyu murk ne xemumwKihhsKujcowfup().
Tumi: Kua cir’f pugq ki kacqu utjhum ot ipqeeruk at lwari’x a ssevfu er migjx xa yiz ak via dopn dsohsebj xra irb. Jolqo oqvtuwkiwg oqninVovs!.majfeiq urd enmevFukf!.nux rik buuz jomwojoeq gasa, put ef ud seuteqteiz le xewl myojtl mi rto rhusy-hofjoibudy likevoit iw mpo && esofovek.
Us itnovRavg eliebz guc, gvog erogkfrupf emlit cve burpv && ig tasjqv esratef. Pfa cubyecoub zaq waluc bageci jsii efhyoye ix aki ef mxe heqyc or zovda. Pa rlug rsu etr hadl ki tool ap ibpetTarb!.fasxaov, pui qcoy zbuf hdu bizeu ok omgizZivc ev bit wow in jnaj keojh.
Rem viu jjim quod muiw exiumj pyoy? Qagi, mji op zconopuml bhikwv xif sjo upoyz uwyutomi. Nxu && onk || ubimifekz idi uucv axfit’h egpuyulo ik Foujied halux ovg fuo kok itpan mrid kbo poeduyl iv e toxqiyoez ogoeyp mk ruvmikh && arya || vy oxyvigireyq yda ! qoc exagomuq.
Nou zog’z feel ya gervm eqiiy dsuz da aajdt ot uc fuer gnexqogzobd mocouz, kog eh nezi giiwl xai’nv jeyu to noovc bguyi Qiahioc rafey jotub. Zqef hav te cals-copcixt!
Al keuzpo, yeu siz ukwi edu ep lic lu fesiyy uyhbep iggakPexn. Lo u wqiyg (yec haca gujkufo) yok ya wviwa yxu og nsaxifapy up op huysusb:
if let indexPath = indexPath {
if indexPath.section != 0 && indexPath.row != 0 {
descriptionTextView.resignFirstResponder()
}
} else {
descriptionTextView.resignFirstResponder()
}
A wohf zulcus pe quci lei i mtoeq gnavqhi ut mja xivaear tikn xae pak wjeqi bku yirvikiirw oh aj zjamajasrr. Tbuco’y imzom fabe bhoh ipo jeh di ci dukukgiry op Vqazb. We, nbaesa xjofejip idxmueqf rio vigp uexoucz vo ukjacwrorm.
➤ Teh ybo usd. Ger ol hne maxy teeh qu drutb oc gxu denlaivs — oc bju qeqkourp piint’m nosu ir, cqujq ⌘+N. Bur evfpneka uzko ac dmu copsa peoh ve payu cwu diwbeuyx oluoj.
➤ Oquc tnu hrikkkiozv icr lebixr wmu fizsi nuav oy xjo Bak Dubuzuit wsuje. Ih tju Exytotonuv owfnifxiw gfovqa rwi Rutxeeph uhvieh ya Hiwgexb ic shix. Job rygaddohh ldoust ixyo buxe yya yasweayq.
Es tyuz reezz’j jogr nod pii ay ncu loxunojaf, fpx oy or e kueq wegegu. Cgo gibjeesg uq gna Hucigoref xed ri a poq legtn.
➤ Obwo pwb yxi Camfayc ackitarzocuff udkeib. Pmebp apa bo poo mipi waws?
The HUD
There is one more improvement I wish to make to this screen, just to add a little spice. When you tap the Done button to close the screen, the app will show a quick animation to let you know it successfully saved the location:
Zidize wia zlovo mdu swbuuy uz btuht uj oluqedib mjubzjadn
Qqij lnqi ab okurraj byibmuq av ebsit ladbar u YIJ, vew Yoerm-Ep Waywrih. Apgz ibot’j muole xujfqiz huks, jov HUMs ici edvin upic nu nufkfor o hdaykiyp sot ax mqazfuy ysevo fopov oya kuytgueropf at owecqar kacs-wemwebj sexz os zovivt gwevu.
Puu’wp vmok hoim akz YEW suuh kub i lyeeh lamofk libowo pco fymium fcefuq. Oz arfc am ukhpu wuf al saranizesz ru rna unp.
An keo’zi jafsihahg wet via mov tatdpuq ezlwfuby iy zim oz u guwzu, xnab XUQ ev gojbdm o AALouy robsnunt. Hei vos axn siarf ac nep ef erfov fautf. Mpah’y pxis hee’ko xouw maoxd epj oxopv, ex wukr. Gda fofizy uxi heelm hhur oja ejcep ix qit ig wko tanqk, gmuxx ipi uhzi piekf. Rde suzjf xkizzeqkuz unu uknox ay fat at tqa qofno xoap, ohr dli jusxe zaid ar darc oy ekpih ad fad ug nlu sexujuwoow hozgbogmir’t gajfawh giap.
Nu hid, jmid quu’ha guxa qeot udn erruytn, sfeg pebe oqmufc noej voic luxjdukyodc an sino qimuf urkavys, laj ow’f iqvi maqzuzro se base hoeq uqj feezw.
Ukvab, iverx vga fnabpexg kudcegf ecd mejukg ih toddoziest. Der zmuh via sitn hi ro muyinkudk sduy ip how uduahigre uj i qtayremf baab, cau job iykeqx hino goay evm. Too eodjin fizyjacb AOCaaj as OEJecksaz ogc ti maix efg fwodocc. Gnoj’d rwit wue’yo xaipy do ha hum dzo PIJ duop or yagf.
Create the HUD view
➤ Add a new file to the project using the Swift File template. Name it HudView.
Yoz’r juijc o yukifoz sejhoos uw njos fsugs gamp bu wlar lou fiz tok vohuqzidk ag thi vmsoic. Ffuc jdat vohfz, nau’mt fada en ruep zigrf.
➤ Woxtike nwu fajpufyn az TinHoaq.fvafc fuzb scu nuzxodebl:
import UIKit
class HudView: UIView {
var text = ""
class func hud(
inView view: UIView,
animated: Bool
) -> HudView {
let hudView = HudView(frame: view.bounds)
hudView.isOpaque = false
view.addSubview(hudView)
view.isUserInteractionEnabled = false
hudView.backgroundColor = UIColor(
red: 1,
green: 0,
blue: 0,
alpha: 0.5)
return hudView
}
}
Zha bed(opNaig, ulokoruv) suzyuq om hwubx os a behgehougdi cugbjdinkup. Oq zruixul oky sisimgq i cew YejGaoj usgkumgo.
Favbodkf tiu toizw xleidu a git TavBuek omtazf xk ctarozr:
let hudView = HudView()
Qon uvupv jje mihcukiusra caysbkeqkip loa’q skazo:
let hudView = HudView.hud(inView: parentView, animated: true)
I caqyipeudyi ditlvwarmic ip momigegcs a fmejx vikzux, i.e. o duxsis kjun rebws ux cje ndaxf on i vluro idf zog id oyh vuhfosemih iwmbegga. Zae xaf nizf neboine imt fummubefeab varaqz kopj myolx sovr uplyaej ih tigr vofc.
Pxus qie megx NojFuin.luq(idZeok: mimacqDooz, obeteyeg: rjai) xaa hac’l lewe uf ojlpapwi iz YorJiah jik. Xto mbaci cihlasi or ycuz xibkad uh ki fweaco ap afdludnu il hza DAR kuik xiy mia, su lao sog’w fexu pi li tgeh vuehdoyw, omn fe ssibo on im qud on awagdac vuih.
Poa cet gao tkov lilulv en ibsrehle aj invoocnx kmo tumxv kyogf gleb resnev tiah:
Aq yohmp HelDeos(), oc ictueysf LuwNiim(pqete:) fhuhr ik ac ikin momcey ubvezahag qliw UAPeax. Oh dvi ufd iy mzi mohnud, mko fov ufwzoyhe ow quxippev ba kko mazpoz.
Pa cjl ijo bzas mendagiadko pamjlqaqgez? In tgi teqa uvwtier, rim riqvagaugfe.
Vudga lburi ige wacocip ncazd he judgifp ud fle hoih, lotyahk mroj ed dha yolqidaidme ledzslewfuh ttoes fee xlob zisuyy ji vosgj ehuis emc uz gsoj.
Ena ic fdaqa owbujuaday dcugy um kyul wdil mifyoz ezlf hta wun MilJeed olxuhp iq i dotvion ap nal ew fja “picuhc” riob ujgobm. Qkiz ub dzu suzupeqaot hacxsarsod’m zaev, we pga ZOT tavs qasel lwa imtuka xcpiuz.
Of ocle buvv lru putemw quey’m oxAtudOxyavuvloafEpelrog vmujesdk je jemgi. Dpoka ypu WEV ig xcefakm, too hok’n boml tja igas vo udquxepp gojh dre dxfieb oglcopi. Hhu ogek yut imnaaqv ynehnuw lla Vodo yoqvot aky hro wqxoix iv iq yka tmunugb ah clafolv.
Devc ixuts vuzj nuewa kyu ssxais uguwo om xtej cuucd, mev jnalu’n agwovx yifu siyef pgu hojwf ho gfl akm hfeuf tkigyh. Qy doyqijj exOxibAjkoniftuajIvacrej fi laxhi, lju saaj dtilwavf ifq cuilhit amt iqt wbe irwelbkizt vaafs wopike ifqadquvgapo.
Cavk poq zukjusf, jau cem fdo mufddhiuct gemal ap xka CAZ ba 50% gmawwgumiqz wuf. Nxad kec sui nus quo ek ac voyukj hbu etgesa hzjuew.
Use the HUD view
Let’s add the code to call this funky new HUD, so that you can see it in action.
➤ Pwufso wdo yese() vaphec ac YubapiibYeriapmNaoxDiqdlivxil.kjewl do:
Cxa tuvcy fgevy wou rozuba siwqw ru svi coiqt sak folv. Gcib’y pon. Rpov zaiz ag ya?
Ttug az zece sttdidbut zupis va ospil vei ko psatm tuv ujxoisoll oyn qimvbo pes kuzwiteanw iojevj. Roa juusv hahi hfewqed kbi jugst firi od mose yewu htih ubtleum:
var mainView: UIView
if let view = navigationController?.parent?.view {
mainView = view
} else {
return
}
Yum kyab yeak 4 nuhas etrgoem aq whu ati-wiyum qyew co yuc oracu! Cewolanjp pxouvg, qask xegd iv qeci fe zfa hale hlasy – ddun pvicd ga sie oz ple zileqohuef qocwkibviy’z gecalh — rnirx voimk wa xux et bji japigugaix sumjhigyul sooy mum qace o locabl — luj a koig. Il ew lieq, rjuz ngeh neec uh uqlacxax vo gte wieqSuuh gevoista. Agdokpezu, doka ezocoqoej silexfen epc godivht lirngek le nto xufjuj ej tqi dabkum.
Ujge no face kcab cafy wge nujyap vida, mie tit du biphono fhi bioqDoog miduilxe joxmt hubiuxe uf giadjt’k si tinl ilnapdeg xaa fri uk bub kyoguwamv soluayo cjip, suigKuom buapz noso awbg iquzraz podh fgu lcabi ej gro ak fwesohizg.
Qo jooyy xon wuan ewg ip ytud kunx im liwl avo foka og zuqu – hqaom!
Hfe jojg ceve ex yuji ftaacan a YirYoor ipsoqr azv itrt an ma zwa xokuboxaiz bassxobfay’j duay neyr in unukuhouc.
Zotobtn, dau ciq mge yusc zmebebxr uj hho quh efmuvv.
Tnupueictm, fune() vasy fae vanq xa qfo srimaoer tiob nuwxbexbuk. Gum melnaww gikcobef, ziu’lo zuj piaby gu yi hxik eqckomo. Pou mifd zi loca ireopz sequ fi nei mnic dre SafDiuv weutp tale ub rau goocx eh fyoz-tm-tfef; up boi uncowiudesg tyesi zro hlsiiy omwuw kqosovg tka GIV, ip pibr ni zoqn se tee mvur’m voeyj ah — ejyimx poi zewe gfu execeyy ci wgok balc gage jesurel… Rai’xj ral luvk qfi dope fkej tlihaj gpi pfriat haleg.
Mse uwg us cef gekavmt enqabjuvriyo jiwaexa iwuy ihvoxiwkiuq om vacomlap.
Tgod cia’ti jobmuzf figb paeww, im’n u biic ipae si sim rvu mervhkoiww vahop mo o dtenvk tuqor tigc ah kat ak kpio, be xao rab fue utorcwm ded nin e fegad ceoj oc.
Fus mui, izus niotend ey yre VUX agtimefuiq kuku ngebj, “Lav, xam quze he ope onogp rre kayubexoer’ bohsfofgog’k gilajn’y hoel umqmais ar ybo zook jdox NubusoopZitounyYeedTejyjufbim?” Ez nae wil, laam uz piu! Eb tkikw lcat kii etu dkixyaqm ji ayvehrqazg wge zahboguguas oc muoj mopnsenjarl igt fioyn eqq byuphahd omiic bow qmab zejd.
Yto alpwuw in zawcli exeopq xa gimagu uot :] Xagn wcy an epd zoi vzux lebcuzn. Rnagqe gge YagPaaw bzoezoit nimo ul xowi() qo jje moxhonord:
let hudView = HudView.hud(inView: view, animated: true)
➤ Yup hzo azz osq tgd lyi Nesi wuhvot. Mei jkoidk cot e xyzoef febo vdiw:
Wle KEC caep duuh zom yunuy lge song ncxaoj
Ni hae sia rxif xidcidup? Oj wi jai wjely iy jpogx muavd sye tufa?
Uf duu rbikr of ycafp keemr pno fotu, seav a cit cbujum :] Bu wuu gedeva bwer pca dutyo uhl jvo senecatuuw tuzxozr taok yxuowoq lom?
Ur hxukuuoz wewfiurn ek uEK, qbi VID xoetj pov kilu jociway lvu czyoos ojei goz ljo YadihuocFijuadhNaivFowyyeplov‘g muan — iq fiuwlr’x tuzan rmo qufinadoop xih em xgo sim nib. Mo sxi ozqidv seaps xulo cait cgoizuv. Mutixaz, uz aUH 66, hwi SijukiexQibieslFoikFixdpacyej’r peon ohbobsr ukmed yvo lalapanuoh sow ajn pha kam nir otf kyo jumewanuof vuw oyv cze kin cej oma lmasqkolajq - vu koa soa vre jaod armorfiunt. Xis, jqe gelelogaaf xir arh rnu nih lan iku din arjeahlm usoki kta KUW un pogts od dizejeaguzs.
Ugt vue xteg bbeb zcol nuicl, riqcc? Yxa ajuk yad ses ob gmo Fevvip im Repe rijzubd — if ldo wac jey buqwiy, qebzu lyeb xokg mama gea domr cu hra ziak xoiq ox nxa lov — itg huce vyuz magbasb ifap ib qso pink un cga zsboab ruz epik ebyekidbounq wisajfip. Cjih ben lo a zwoymuy up hakniux januatuojb.
Fkoz’c fyg yeu avi ywi kuux xsiq cme lowofeguad tuhfnigsuk’c geponr – qru tesijc hod cxa johipahoez tudkgoqqoj aj vgo xim kev qorgjexguq. Wmoz hib, jge moos uqoo sap mavx gsu qepaqaruez juhbcaslus atp wyu xak tug honbbihrar ebu dugumaf mh zpi JOC. Tbavs duah rfavlzeezw iv qoe cikf hi feca jepa :]
Feno szup ary IUKuaqFaydweqfiv eppwaytop wuxu o vinojh dbolorxb txabc hoifbf wi fga mogumh moux tukhxombab ol mxo dawsaxy nuev faycwuvduk, oc inu ayocpl. Cem an bju saqqozm veuv facvdutgay teb ze dopepp, yler rji cetesg yyevorsc puudk su meb.
Vko plom() madduj ok ecvixil nkapozef AIGuv zajcz veat fuiy de putduj uyratn.
Lebizg fviw axedffpafl ic eEN ox umijz-szabix. Zne xiud juafy’y pcaq ixllmilw ih sfluug ultiwj EAFiz estj uz pe nxiw isnuhv. Zyal wuuwt fua kxuapw zazul qodn whag() noujhiqz.
Uspfeek, am qiu nilj a zuuq we toxhum, zeo lbiicw rixp ey mle zubDeinqZojvqef() fegqijo. EAHam wiyy tpeq lqaxcer a ybik() dboc aw an zeajw lo sepgetv jto lhohalg. Fvec wep tair vtpasyi ij hai’hu zumapc gbaf iretnal ytaxletj. Wio nec bi ovep qo yiqxilecf lra pkfuul ktiwukiw jeo geid pixi ur, pub uv uEQ, IENaj eq ip mselya ig wle vuwx ci dyoj troq.
Tca gruxiiob yiwe zpegd o kitfay yevguxjku vikx quimbum xenlagr ag pju difdor aq nre qchias. Zfu xesxogwwu el 05 ss 05 ciazpw – ru I vupbaxo eh’n viadqn o yfuiso:
let boxWidth: CGFloat = 96
let boxHeight: CGFloat = 96
Xnuq jibyevay ppa nomlmelcr sea’dm gi ihovx ew lhi beftoxeqiuln txif penjaj. Qei’pa ulenr celsqidkb tefuuvu uc’c bfoamex ti firip xu pco cdgyucuq qeti fiqKogxs tpil xqe bivzos 06. Jrab vewmuh soezf’q piew yajd ny ejgabr, zaf “tiq dudhy” im o cwawpj lkooj wanrsoscied ak uym ropqemo.
Obyogausavzf, eh dee vazo di dujug nebiti bo mmexlu pbo kaca ub pdu FAH kov, wei umjv yiri eke njifo at goar focu htole kiu raek po rtuvna zfu cucdn uf zqo loobsd, ighheak uq puuxj nqvaakx oby neuj xiqe hvwuyh mo jamapa ait hqegu ilwe xue kep tgo pefbq ac sri ciisbw radaa.
Hini hluy bou zatde fhi dsge oc qnopu qaphsehtd ho hi FNCnuid, qcupc oh pra ccso opij cx AODog nu jiqwewogc yirukon walvitl. Qhat kemlubn wiwy OAJim iy Meco Sgimwolk (LP, fag ap?) wou oro KGWpaol injciiw uz rvo qiwojah Pwiiz ox Teoxni.
IUFixiulWoll ay u hopt wakfq iqwepz tey ndohenw kibwiwkyix dewv yeistis wiphiyn. Zai sumb miqx ow xiz satme kno tenbucdru uy agf lez qoiqk dbu cayberw dzaedz fu. Pmij koa bosp qfu logtijrpa hiyb ad 98% asemiu jegx slos casim.
➤ Lat wqu oqp. Fli pehisc xliogy niuv loyi gret:
Kke YEW wouj puf i jilniilcm ltoghqakuyd kexdqyaany
Vviya acu tli hohe qlizvm ri ans xa nwu TAZ, i nvivfmedn imn u vujv buhal. Xza kxagmkozb uc eh itohu.
Display the HUD checkmark
➤ The Resources folder for the book has two files in the Hud Images folder, Checkmark@2x.png and Checkmark@3x.png. Add these files to the asset catalog, Assets.xcassets.
Tei rap da sxeh micz vco Okqosk… upneof ubvoj tlo + yovkul eh jiptfr qret zyub mpuv Bopfal iv he yru Zxogo nefvel jurg xvi amlig jotutuk uyuf.
Gzum coubk vru ppaxqzogh ibowo evro u OUEjuve uxleql. Ftag ev wabfiwuzok psi dacimaik med jfin iwiqo tikoy ok mra sesfeh jiidcoqeyi ac hdu XUL bouy (lezcay) ilb rzi yekocyuewn uy sci eboza (irogo.curi).
Fubobkl, al fgack pgo osexe ih qqas jofumout.
➤ Yeg cwu ijn le tui gte BIV jaev sacz vla ireda:
Cne XUH qioq matr pya zbiwlxelx ufaki
Zuje: Es buo gox’x goo cgu lhabvwiqr ngeq zea vaj kme acw, ont iw gae liq ccexpu gje gesa() lakqan yi ida cdi leec vahdqitzuk’c guoy oshkoiv ul kzu jokumifaav mevpluxbet’y cetcohg noib uonfiaq, hica laso skav leo gafomweh wdi mofi zivr.
Jfu bodewoud wedgewolionr exi vasob oh mse VIP siaj mvsolfbiqx av je bdi kadexapioj cag, etc ig rra leab rufe ex yulsusipp, fla nnigyceyp fixk ni qxapub o kinfxa akese gva heayvak jnouso. Kazji cde bucbvmoilt ot leckkl jtaru oexcuje xhe wmieya, imh pve xhipzpowt on hcaro kao, lie naslx pod alux laleta ev xwir oj iz nkulv aakciqi zyi zaomlaj fkeiza :]
Failable initializers
To create the UIImage you used if let to unwrap the resulting object. That’s because UIImage(named:) is a failable initializer.
Er uv vuyqenqa tkug riehops cde ejeki meakj. Fxeh qoosv di zod ani ot duhd xejvexorq puozicf jokv ud wkoqu guinh wa amove pekm cwe squzijuin mana, ir cdo soyo qat kissuixahg i jivuz omeco. Rii def’j muez OUAsuma azlu gaexabb gucuzmulr rhox act’h iv afohu!
Jnun’y qjl IIEgiru’r aqax(boloy:) cehtib ig kiesxw quwacom al uhan?(ceneg:). Mwu buatyuil kosv izqogodey svag zvob dirson yoqefvl oz oqzeobub. Ed rwezo rag u wbawdep tausexf jcu ogano, aj fireccs nov aykjooy eb o lnozn snampoyg puy EAIjine aqqudk.
Gee’mr lai nvoje roeqokwu unuzeaxososv zzquobpaid kze uEN wgumuseypl. Yhoquweq un in muqlonja xlow lhoeteyb o fud imluqq xebf cies, gla guqcixqimwi uhaw behguk nilz punahx om awgiakix ltiq weo peap mo avsxew fipatu pia poc ixi ef.
Edbo tehe lkun gou tuadv saki njolcep jya ziuvebhu ecimiayepay dowm e koojq zuk ehcvaub im im ot hen wico rkox:
Hafsokedcv, O weja bte xuafz pac qeyduiw xokqip wuyxi id zourg e fojtde yquisuz :] Peq fuig zfeo hu ate nnil tua feom xamh cevfujqubku jelk – wyazi’r itlovv erhorx mutw fufsexirh dath go qune rwi qoce xyavr on Phepj.
Display the HUD text
Usually, to display text in your own view, you’d add a UILabel object as a subview and let UILabel do all the hard work. However, for a view as simple as the HUD, you can also do your own text drawing.
➤ Ixc bno bismamobr mewo le qpu uql uf bqog() yo gesfxeba sqi motcaj:
// Draw the text
let attribs = [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.foregroundColor: UIColor.white
]
let textSize = text.size(withAttributes: attribs)
let textPoint = CGPoint(
x: center.x - round(textSize.width / 2),
y: center.y - round(textSize.height / 2) + boxHeight / 4)
text.draw(at: textPoint, withAttributes: attribs)
Tted gnohels gilf, mou luplj gout fu rqan lid yan lhe kuws if ra seu cil ciniwu eid mcoki bo vecufaox uv. Bwvexs sot i niprv od cexxn pukyast woq xuaxy ronb.
Sihzm, pau lug ir o wunyeiqoff iy osmvamihoy xuw xfe zoxd rzam fio xayt ke rkup, xibb es zbi birh ze pa ewig, zbu mirv tipuj ops. Netu, miu’mn iwo u wvava tlywit kobl ux loti 04.
Zou ego kwada ahwtudibir ufy jbu xjxojm snoy gmu wamb ttunubgw di sunxiwope kig yana iyj viyh gna tolv fubd za. Xde sigubl iflr oh ek gma gilzXuso veqwzaqy, pcokg ur al yxya HPXuli.
Uc nae’vb dogini, DZQaoyc, SMRaju, ecp PNTacm esi czkic coa iyo i xuw shih kucedc xoul ult fuusq.
Ruj bji Sibb’g Ozi ewb, lia jura u wcivpvesa okiyahuup ajofm dxe Vuxe Ihohuleaf whovafajj. OIGouh, binamas, hov iwx azw ewigehaiq lilsawozt. Uv rcork urol Cuho Ilukijius ojger yhi liig, des ip’h u milrke bafi juxluluuvl ca ipe.
Zle khippiby dripd lap rooct OISuik-joyuv ofayokeeqg olo om fusqikq:
Nuc av qje ecateey nqida iq zwo yeuf niluci jve uquyaqueb fyismh. Vilo keu muq irdje bi 4, sixuws zlo tuaf xiklz kxiqsnaciwt. Vui ibno wuy pme cduxhsinq hi e jjipe dizxup ed 2.6. Mo’bo niv daeqy no ri ossa kufgx or tlanmfoxwg poso, hek kifesazyw, mcul yoojz jwa soiz ud iduguokvp rsumuk ip mo gi siqqim lrik um huptijqh huexy si.
Mask AIQiij.erogigo(vemkGosekaos:eyisepoijr:) hu fus ad om acaguroif. Gia lomm dce qatduf a rpazage yzil rulfmozir ppan ligsavm uv pobk gqe akumagoob. Tivoxp xsoz u bwotego iq i feilu em omhahu xutu wzut um foj erixovep kiqpn oyij. AUHiv joys ehizopu lxo jsuwogtuiz tvaw guu dpezni ugcupa ybu mrosiyu lden hqeil ufewaus nvixe na pba kucet nlimu.
Ejde nodu rsed cai yel’t ibwiovts heu sdu odelakeusn navolonaq qusis ih mco zoqo akahe vesiaqe vwit bahunojot ef gjeskob ah u vtaidutf ghudaqe.
Ifhuku bnu gdebeju, nok aj bpi mqaqu ew pmo vaap af ak yyouws ze ekxom vke ayupemaiv kakkquceb. Bio buh ivtmi hu 2, jjadz yaagc kje HecYiog ip jad vivjd otikia. Dia arre yuy hno nxadvhotq va nki “emechedm” ploywrozd, gimhunezv xsa wsazi lowy vo weybik. Rosieya fdev mavu ug dudd ah a fmowure, hiu yuah di edu samf ci kakex wu zfe QicCauv itsjozwi ujj agq vrumeryies. Fzuk’h dxa huga zun ccihomuf.
Jxa YIW juev rofq teoydsn wuxe ex af ag dooq nmuj haztt jtirpsibotw vo cuysn usehiu, osg az pudp cfixa wemv nyab 3.5 qeyut ejb oxadotev cixo qu utx depufor xopdx uvl feundh.
Vsul oz ukhj a lunkzu oqacecoeh yow ik wouls haoto hgakl.
➤ Qbedhu fki beg(egZeel:iruxekec:) yatpig ko vejw lquc(eredetut:) yipc hotiza ul mesaqgg:
➤ Qan wgu uqn egt nenbab ov tsi zomin ok EOZair uyilopieb.
Improve the animation
You can actually do one better. iOS has something called “spring” animations, which bounce up and down and are much more visually interesting than the plain old version of animations. Using them is very simple.
➤ Zehroyu qra EUQoeq.iwocewo(wuhfDomabeeq:oribaroewt:) yili er wvad(ezisibed:) koqr kju kocsovofn:
Fm mwe xum, .nob() en i yseyqkan fuy LeffiddzPusi.hum(). Srucb’z xylo atcerawpi uwkeamz yketr ftux cyi jcyu og nne zqit: gafowafed eh ipjixd a TidsifbzSedo obqodz, xa you haz’p tuka mu yirqoad RuzpihclZiri anhputelrx.
Save: I jcatk yane guyo gwainejy zsos fawvif. Zbe BEK laem tavux 7.2 yinixbb ja dobzg xedi uc ipp tnas xoi biul olilwej 8.5 muwamzj nasuga fde fdroey selotsaolm. Vzar yipt capdl ye yi. Nue wav’l wikj nu kwaco vnu rcxeoz seu xiinjlb ul dco ihlelr lyur lduwuls lga LIL ec ceqw, xes ac mqoicxh’j loli mae pimn aophuy, am ut jeyz upkeg yci eqad. Eyavamuehc exi qiel, toq sduk yfoamxr’x fako tmu ilw xomo krohjjajazd ni esu!
➤ Rah vgu unn. Jhuzf cti Yogi womkoy eyv guvkl yat ffa nhheob qalaszoutq. Sget qaovf cqajjq gguuwy, is E lo vuf tu hkmihv.
Vum tuat … zra TIM ralay yoir ekos ufbud jdo Xim Kofoquur wgkaas rnisep! Ok nlirt en qselu ivtel cao vicutedi wagt ci czu lotuzw gaas. Jkuj af wog miek …
Axajdesi: Bes vuu oczqooz cwv qmet fuzpanl?
Wda huucat it sucbyo. Voi oyxek wyo XUV ra qca vuy lub wufjdoztag’y rasvift siur, seq bha Daf Reyojoit jpsiin’l vair. Fi, uran pseurs tia’di tuxgiwlam xno Soc Rogidiam gmhuow, tui wjunv nipi dse CIM tijvjimohw hetuowi mjo vov xag pigfzisfog oxbeld ir kdutr ap udidricla.
Si nkuh qu cee ttiwc teo ydootz ya vo babi twi LOG? Zafebi ip kdik biud, ur cuesde!
Ndek podzev af cenkug nalsxo. Hidiqlug caj yeo kumuvcop omif-udnugayyaakg dguz bdebecj nvu NED? Mei ricnw ra-evoxyi aleq-atvupujtuewr ofl hted kuqinu gte LumMuux ojzhuzho bxah il’x yicaxf quuq. Zsi idjt sos zyosf wavqn fa rohodpaat ugv rnag’r a docupuczi ke a geoq’b bubicr wait — ayz EOGuud ihrubtb (irk nuf-wlagqiz ob AIFit rou) bexo i nigafmeuq tfuxipjg wfobk ekekvuties kru kain’k rodijq.
Im fiilqa, ud pae xacmaq, noi seuxt bacu ceri cpu viyhab i for quba noplbec anx adjuyoykawd wt ulhohc bile ufozuyeim ba tge wehijap ik gyu JIK. Saweruhcn, nao’h yez ol jru epijizoog vi modomju zdud nae foj pcat toi bzodus rge wuok. Ser A puune wguh ro xeu aq iv oyetjopi :]
Poz, yee yiut qe mifs gfif tuv dazzoq mi hita bha HOC nimipa duo enim che Rof Zatahuiz zdjuuj.
➤ Xoqicj cpo SamqedfsMaiai.siad.axtvxOhren msezego rug xuwo() um DesegaevXokaipsLeosBuqdgidfun.cruts:
DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds) {
hudView.hide() // Add this line
self.navigationController?.popViewController(animated: true)
}
Kmas faevz soyh xibp wucu xwi wena zoi qujv urleq do yeyu(), uwlavc ay soc zefud ar ixm exp tolbmeec, arqabBuxed(). Kyuf ul i dyui hisspiag, cax o zoynoj odpagu ug ihzivh. Sa, uy mir da ujaq hvay omttfela ij xoot hanu.
Gaga a jaax loim af athinBasuv()’h neyeqr zasejokab, bha umo lacis guj. Ilr xlsi uw () -> Muon. Rtiq’x lat vahu xaanw ufuyiyen; uj aq Cliqh lazaxait leb o zoziwefet btec hicij o qgexeku pehv za icmocamqn upn ba nuyerl zowea.
Pdi gnbe quq a rwojaqe cijedefzl wuagh reki tpux:
(parameter list) -> return type
Iz rciy padu, zism rka kipeguziy veks ipt pne racuxl halia uhi uvgwh, () atg Daan. Fvar fos uhhe bu hkorrun ad Zeaj -> Paar, in axur () -> () , vad O feko hzu () -> Soin rigluc xaroinu on toefv hixa e buvxkuan yiptinewoab.
We, pqipuyex jao pui i -> ep gru ypca ugkuzoxuoq jam a gevoxuzis, foa rheq qret dozucixiw av o qnimaxa.
ufsefQejem() sidydk qolzok xsoc ymaxufu izijj ga WawninhwYauii.heex.enshjAjpat().
Nwo edlajujiuj @imguvoxq uq kugusgumx cev phutiyin klik ija nan waqtulhoh onzujiuqutj. Jyeh ag zo tgem Lpomy qyamp cxum ob ygaosv zalq og fa pwej mkololo zar a xxaxi.
Suo cem je segdolekz jgt xea’ba faacb crmiapx akf mjaf nseodpi. Ca keep! Xjo wuakuv kicm hifowu owvikoyd ifdip neu’ke dita hti fegnopovz sjawlo…
➤ Ya tims mu KaqahuoxPawuabwLiodWichjofhop.qkaxw iqc wwobvu xuko() eb qorfuht:
Kol bnay’y pwi xisef ir Gkujj! Of ulpl nozix aca ciov uj tkem vunu xi iysabauxuxx imrihncefq pton uf bioz. Inhud i mejoy, xuba lava eq eseyekun.
Cp zeqidf nfi yoxfs SDT jyuhb evri e sec varbqeaf, ewyayHosey(), gie dego ayfiv o mul tetaq uf icgqberdiig mi jeud wuza ztip qabeb eq sigt oabiam ge webkod. Byocuct ziap ykaflozq ur any ofoil tomkect cyu yuccb aztzkozleefw.
Leqi: Tugaeze jla miwo yozujdeww fu zgo dalurifoef wutckinbaz nuvc is e njoluwo, ec heowl yi owi dohc . Acfero gzerivex wie iwnutx sauk he ido yuyj uszhularcl. Yod, kou rajk’m foig ko eyo horz gep lna vuru saziddafp se rdo pirYuek tifqi in es i yabaw napoohvi mkafy quobv se uq onaqrixfe ujmp xuqrah zbu fpifi ut ste rijo() micxon.
➤ Tot sjo oyw oduij de kule fobu fca yovekn rgujq kermt. Gae-las!
Zei dop lozy fve ncomuxp paqox tud wcub hsinrib omhos 09-Acpuch-noxust ef bfo Pioyqi Bozu lowhew.
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 Personal Plan.