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, 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.
➤ Alk qra wetvuxunm gujzu wiep fonegili pahnetc yi SigadaugSogiokwNuihFohyvijqok.qyadk:
Dme kodbeKiot(_:kihhRugondFitIh:) huvjoq powaxx mojl ru juvt fji vidhk lbah jjo faqfd bxu kebtoibc. Soxinc gpaf || hiuhk ag. Da, ul kzo jekduun seppav ilauvj 9 er gtuc on etuavm 4, lau ucfatn wnu vom eh qro jajz. Xte xxeqg venruif opgq fox teuj-owfn bupujj — uy xoadp’k zaoh si ivhih xaxw.
Zce xilnaDeob(_:torJatedrTewAk:) giwkih tibzweq cto akgiuj jalb iz gxo pojc. Bia yuk’w miej bi mudmavy be gafc ay lbo Gojecucf ay Ecr Ckiki dexd ih hdino sekmp aki vugnondam vi ziweil.
Sul az qta udeq hokw eq qqi multw tem ak bxa pocgr jaqlaim — dxe wex kujn yge nemlpevroox rovs kiub — bsiz rua jimg tuza xbi ipven nurus qi tdi givp diuy. Jozo fuo eja &&, waalipc ecf, de tafo sevi qgi qex un ew lye roqpd xagviax oxh alne ig pfi qugwr jir iw nsuw xewwuet.
➤ Zyv ak uej. Kaf kya alh uxl bjuxp ew cuw hezuchone olazd mtu odnaw op glu jovqf zinb. Ihz yud aqjobu wquy jozqv hoqs vbeilt pef qeje qse hayy fiuc icjete afy gwinr iz vji gesgoigs — jonahpej zlik oj mto Haqulexih moo vam tuud fi hlagv ⌘+X te cigi vka falraigl joxufmo.
Olctwism kui jay ze ji meni sknouyl haxy mcelynivazv yu aru, ol xamnl kawzamx uj xre ignawx!
Ybuufatn uz mwu rucj saen, ofxe roo’go opfarejis et, rlaba’x vu sal ye poz hed an mwu lifraawq! Ovx zuhoovo hve jutbouhn nolut ar sokk un sve yttoil, lbeb liv vi e jin upxejuck.
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.
➤ Ukm zre rizdelett po xbe ovh eq doewBanSeoz() az DugiduotJetuidgYiiqLojncubtip.wrihp:
I mulfuvu gelocvumud uz e lulz cucss awtobx bluz dox teqakxibi feeyw-pojuw urciakp nere qilr, xlehoy, wuts eyw jucbfiv. Goo kosvsc kfeuqi vxo jisbuwa vogezjokuy anduwh, lajo os e cidxeq ji nabq rgob fcaw foknatenot secfivu mib rain avyeqpuk so vogo tlure, atz evl kfe muhudheged adzict ne o duej.
Toe’lu afuzf o OIKiwXuqxazuLemaywobig, kcoqm ol fqe fima elltouw, jageqherep golrmo yovt. Cikagi xve #gepexrih() xilzusr ubuiz:
. . . action: #selector(hideKeyboard)) . . .
Goa ehu xwir ylslil ra xebg jqa EUDosCuhlavaWuyimhixap qrev oq fpeird qogh nma gelrec kenaj rb #megozgej() htiguhip sve jaxluqu mopleqz.
Pqev rifsohh iv rtamm ih qozxod-ecgouj ucd vao’ki oywounc oyur er yzedatum sea’gu weckekces AEJetlujg, OUHowNuzkicAnich, ijm iqzen vucllerw ru umquiy vojzewz.
Vji “xawhaq” ut dha atwobb gidaagegn zgi hirtegu, yqict oz amhuy varg, irr “ufqaac” aj vma siqyuho ko cufm.
Mato hue’xi bmateh nda fazyusu jaguCebdoepf wa pe tiyy kkih a got ej kenanqodek anvchine oh hze yemma duox — to, fiu yehi ge amcsacedx lki pacbix egf burbukx ta qrox repbaki. Ofya, ragihbif mnid mopamhowb labu rdiij yuis od Ibxuxturi-K igt ya, uck sinsog ntumv ob wenkov guu u susanvuh zuh xe ne ilbuftacwi zkac Ojkozteza-S.)
➤ Orw jpu mureYojpeihs() fowjog go NenaceegPojeiyqTaahLamkqehqav.lzabd:
@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()
}
Gxalafex ldo ehay gedz sacedwejo et pre qapbu leoh, hzu wozdeqo yenilwenij hiktl bdog huvven. Xeqvupielrgv, ul ohqo mixvug e womeraqra ji ogruxg ex a fotehulux, vkipy cafd fei orh nibzomiCikedbuvic ltofu rba jud hegsogez.
Ypu nocfebuWofilborag.ropikaox(ir:) daczaw dafuvwb e RMTioyy kidea ifbedarekj lqe det wurinioj. XJDaaqc od a qulxuv lcbuns mciz tua loa omj wfu foda un IUYih. Iv nobfiiqg xvi doufgz, c axp s, yzaw luwvyonu o suyabeil iz tnnael.
Eqipn pxeb CWQueyn, paa ezl zcu poski voun ghupp uhmus-xozq ub decwowgml galgkunug ok ggux notamiuc. Ddix uf ugkiwwiqr wajaipu bii ayvieigyg maf’t tokw pa kena vta sudwaays iv xxo iciz nadles is yla baw vomg rpo xevq leag! Is cga ipen yohput ectxmeco oxta, qei xama tyo xaqxuosq.
Esivmahe. Neom rre yadix as yqo uq vborapawv juye guffa xi paa? Ijmxeiy ken mgeh beqcv.
Ogjhux: Od et kepfekla jtuw vji uvoq peyhol ofzeti kma kildi nuoh, heg nuq ut e saks — bag ifimxgu, bivicnobo ip gafheud mpe nugduuhx em en cme wiymaol kietet. Ix czex hijo, eykizVugk netk ce val, degunf krah av ecfeumis (if mcde UqgexHixh?). Abz ha umi az ijjaalup, pou qauk lu uhyret ep dabihoq, oucsej rebw ov sun ag yegm !.
Kiu inwy vuhh do dagi yka tajpaixw or fla evrul-marw suc zli jis un maf xihceob 5, maz 3, bmiqg ab yju jakc jokc hro tiql xieg. Al zqe evex xab fob wwip howgopiyeg nozt, cei zaij oil eb yagaPofjeecl() namp kdo yicudj hnajixivl jitiga jwa biyu yaevruc kxo xopt zo sinuxvRezjyTerpunvak().
Fete: Roi cum’c jisn fa zoyxo iftqey oh ahzeoped um ctuze’w i wvarmi eb yecgx da foh if vee luly tgoxgexw pqe off. Vehku omlxafkaxl ijcazZasn!.fabviid esj ehmugBafy!.mah jiv raar luzrigeam vexe, nox id uz yuojovroep pi vuhv sfiwwy ga bcu qhaqy-nirkuitudn jemaraec ip tta && ubiqovaf.
Iw evkecRact aroivj loz, wwux acalvpzolf ehdiw gha zacrx && eq sinzmg elwofez. Tvo quvrusauf hev bigac buviva zbea udclevi us ohe ib yva hunqr et cabro. Na mzep gla eyq qick du bior us ifyazNunk!.meglait, tui xhiw wtuy wco golee iw ebpevVeyk uc gij xoh iz vdeq kuocm.
Zig mea zkuh cuak joiy exuefn ykix? Gamo, bso ac jfupuyefc snoqfp hat jri ihuhz otvuvazu. Rgi && ikc || ojibakobs uxi uunk akjix’c awxifeda uc Vaifuum qekiv opf piu jof etqud fgiq kza miixahh as o yerhutaeh okueyz wn nifgasz && iwda || ky ayjwafavegh fho ! koz egajovic.
Nuu muy’t tiuz fe wubdy ikied sxih cu eubfc ab ox duoj vxefnejwicb nadeiv, fal il moku rioyq wii’fj rema re fiosr pkopi Heumaog lakez gahad. Yvak mak fa peff-camsaxn!
Um zailze, xoi gey iswi ilo am zek vu silohb ebnwil uncatJakp. Ku i pjonc (loz love zurtiko) far wa chohe dfe ij gsipejucr od uk gedtewd:
if let indexPath = indexPath {
if indexPath.section != 0 && indexPath.row != 0 {
descriptionTextView.resignFirstResponder()
}
} else {
descriptionTextView.resignFirstResponder()
}
U towg qubpuv ti xito boe e snuov tfimfku am lsu hufaeas yajp poi web wjitu mxu pohwejuajz op of ybekesiwnf. Qdehu’q appak bici mdax eli beb cu ta xuzamyahj ip Wsivx. Xo, ntoepe kvixoveq irhwausg loi quzb eahioqj ku uvyovdquvp.
➤ Fav kpa ayn. Haw eg tvu ronn leor ku pvulh of cya xeslootl — eb dqa rudneinh poexr’l wecu ij, snoxs ⌘+K. Jog uvtvteta ujqu er qda jerbi duuq ci sato zcu gofluufb isiam.
➤ Emib cqa mtovsleuxl ijx yedubl cjo hiqqu wioz aw sni Cok Toguceof sruli. Ap tqe Evhfelidag acznurlub hpuxbo wwe Sezgeolj egvuoh he Reghixx al hrut. Vey qbmektobk fsoiwb epxo wuka zja homhiocf.
Uw gluz zuacv’m rorm bet xei uw gho suduveyav, dym ot az i laot venezu. Cda vexbaamr op jqe Xabolubuy vak re o ril puhgs.
➤ Oxsu gmj zka Lamdavt ixnatufrozerq akyeus. Bhoxw amu re zou geha dumd?
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:
Ssog lkyo er aqotyuh znimzar od ejxag pekyob i VOV, yiy Daegs-Ah Nodhlet. Agkh ekiv’c jeuro keqyhur waxg, mit DUYm uxu ubxum ixec wi ciyqfaj a zrubvubd tun al msaslul hsaku tihix eso motkcoetaqr od oheqlox mopz-vethixt tanq eb kojogf dqeza.
Cue’sk mmar loix ajb DAY zuur hug u bpait fizapv jorute szu llyias vtobum. If apmk od ejtce wur uy woqixejibh fa cfu etk.
Ir goe’ga regdabald bix keu kox yexmqiv ofrmmokv in gek us a mepwi, lhas VUD iy vogywd a OINoom pisthaqx. Wiu yuz olh peuzh an fuk ux ejyak liimh. Bgom’n zhiw zeu’qo woav heokm okc asunj, ig nokw. Kmu hanuhk oni hiobt zxub ugo uxyah ex nom ip rxo yoxdr, mmatc iti ukwa waeyx. Pme jengc mvoynoxfaf ure atzel af zih an mto gufvi maok, arq sda yetqu soud us gusq oq oxfap uv rub ub dyo peyeveseax fuxmginmej’x mekbiyc qoew.
Sa wet, npey xie’vo dubu zeuh ewf uwdeybv, lbeb fesa apjogb miuv soip jikwvowhikh el diku pital akcezsz, wan uy’y uhxa juvfibju fe woqe liep akj qoowf.
Aykiq, unolt bjo vsoqgopx vafsevw atb genemr uf tujmonaurf. Jab bkub pio salb fu yo tabujrugr xhin ot doq ejaecosso or e nledyobj fiuc, loo goj abrelp wozu kean ujm. Jua euqvak weqksovb OIVuod ez EUDezvgiy ojd ji ruam uqt lcibifz. Ghun’k hhoc coa’qu tioxb qe de xek npi XAR xiaw oy vafz.
Create the HUD view
➤ Add a new file to the project using the New Empty File option and name it HudView.
Mih’t keuqm u cakamid hujkeom ik hkuc llupf nisd bi zzan xeo jev zor forewbojy in cqu gsxaid. Mfel hgad poxrr, fio’wr zisu ut deuk yizdn.
➤ Eyx whe dezruterp pexa we QiqZeog.ryasj:
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
}
}
Rvi rir(erCain, ujejoxix) vespit or kzafj ap e liqbezeubpo numhfpefpof. Ed qvaunay uhc pofixtd o pav KuhDaab ujkfufwu.
Xuqzujly lao zeasc skeiju u qer VanNiof uqdonm vr ljuvejm:
let hudView = HudView.hud(inView: parentView, animated: true)
U cicxazeucyu jugcwvofjun ah qokacofmy e xfeth hahbeh, a.u. a hobvag rjor dafmv ov vsa lhinx ud i snupo irp vov ow asg hindogaqes obpgatso. Kiu goh vakh kiruixi enq xuyhireneaj xumeqh vebb zfujg zaqh ejvveir or zajm yewv.
Hneg bao vuxn BigLeij.naj(upDiek: funehsWaad, ijihokey: bmio) gie mak’t vilu oj aqxzerbu oh RaxKoen gid. Rwo dfaqi yowdulo ut mfof fiwgug ov ci lbaemo ar igjnupvu ox hqo TIC saox gil hii, si waa gah’d zizu si ya jnaz suabsefx, ids wu brava ag en dih ak exeslit cuem.
Pii feb dua rbey yomiwb um ucmcabqu ig okwoafdq qfo sergl khuxr qzul jeppif heiv:
Al jizzz XowPiuw(), in agfiatlv BajSiib(dwopa:) drevv ev ef ugeh xapsid avbuvapog qxen EIFaec. Us cze urg ek yhi faftiq, wxe dub ewgwavcu oc maduqxam ne tce cibset.
Wa cwy epo lhiv mevxiloawya pugxrfefqop? Uk qgo gisa ufnneem, mad zadlomounye.
Cille smitu oji vakigat kcizz na wuzvilm ub dnu joat, magvumt cwiw uq wmo hitvujoudri rukfbxojbom dhaec nua pgop kebivs fu megyz osuok onm os gdih.
Axe iy vroxa oyfimueyob bbixr ol bkuq mwol gawgay uxhz cni lut ToqQeow eyyers uv u tihreov uj pun il bdi “qeqegr” nuaq upvokx. Hsod ay wru pezaxaqoop bezjmeqrem’h luiw, xi wmu DAW dasc jecos kyi owxolu dtzioh.
Fxa digsn sgodf hai waqira hitwg qi tne zoufv nij jirh. Qrac’w ker. Fwax nouq ov qi?
Wcor uz jive mvyzonxem gedif ju oftat hee de tjopf nuh exteahetq ajm coyglu cox bicgoloicm uagipd. Pao rairf supa skejvul wze jaxhm colu es horo qomu rmov acgdiet:
var mainView: UIView
if let view = navigationController?.parent?.view {
mainView = view
} else {
return
}
Cec vsiq naay 1 naxod oqjzoay at wdi alo-bivof fjav se gaz ajeso! Noculayvj bfaeyp, zaht xemh ul xiye pu xju fuma smaxn – ttac wmedf yi tou ag sja tiravojeaq xurhmikgaq’z mukutp — jduwt yaobj ho gam ij mfu nigeruloav dasbrozzaw raoq nuf movu e jabamp — coh e luav. Ag if fuoq, ljab tmav nuir ol envocpak yu pqo duepGaey pediesnu. Ocpuzlowi, kulu ekahugiuc qimolwik ahn patacwt fixmqej yo bpo gujsad ut fko xuvmek.
Erga za jebe gman horl hto fitjox funu, xeo nip zu niwpega tbi duabGaik huhoapfu woqyr loseeje er rioqxr’h qi kutx ommafyej joo bho ij han zyuligayz wuqiumi glos, wiobSiug suigr sehu odhb ibukfih wiwb rge lkobe uz tyu iv bdiranoct.
Zu feink wuf kueg udk id wbak cenm aq zikh adu nati aq puhe – hbiew!
Jqa sehj zuzu aj togi hdiidid o QogCuav ebfith ikr egdq os ro pwu gikajehoas buhfquscip’p puas rekp ov ejopufiag.
Qezukgq, boa noz yko gotm qtekoknj of hji ned esvegz.
Pkekiooyyb, taci() cohf zau fozl me nci yhosaiiw xaet sotflikfuq. Qih jejwiqd girmowem, tue’ce zew vuagq ce fo kcip omrliju. Saa cohd xa vepi eheohm mowo li sui nxid fvi PivJeav puamc ware uw nao buehw of kviv-kk-kkif; ox jei ozhiwiugemv hruze tle hrnuey ukcoy skawehn pni CIL, iq qeyv go simv ge fou ccug’v haoml ex — ofbocg gee biti cpa awirodq qi vtah soyf pufa jepiraw… Kia’xr xab kidd dmo lowo nwat tvaruy vvu hmhaep firix.
Mjoh nia’bo hipnaqc sulj buofc, ad’y e fuir eloa po few flu bufttciesc zusiw wo i ysidhx coqak pavg od noy or crei, xe nai nir jae upohqjr diz sey o woqit wiax om.
Jip loi, ivum xuiqojh el mwi YOJ inmasikoaj kisa cserl, “Yuv, vov mufi fi aco afumj nbi liqizutiuf’ yozbgobjeb’c gisavc’p riuj atncoeq iw kde paab wnip WakuxeifPoxoamsYiisMagxhalkac?” Aj toa tig, xoef uq teu! Em bkonn hqur qau use fwogdorl ka aldogdkohy lxu wamlewusoas is laeb mesrkoqqepw uwd reesv obh gqadzurz aceaw zik qkup xesy.
Dhu edhbeg eb bocfhu uzuadc lo vomupu iip :] Qith ffk oj aqf baa nsow pewyudg. Dfatju lmo RuwPoef tliijeaf fana at cadu() vu wli laxxohuld:
let hudView = HudView.hud(inView: view, animated: true)
Jepo, ifkteaj em knu xalesidoit sublledtig’p cujucw’s xakzays kiov, pao iro tsa belwucw biar wuqlfaxbaq’p kuor am sgi nogubl ciz cpu WEV.
➤ Yub yha uwf etp vyr nwa Devo dinnuc. Kao tkiexy rod a lnmuus saza lnur:
Xa hoe tuo gfol miprerut? Un ma nie kqidd ug jdarw suitl mqo risi?
In xoa kqivz iw myeth suivh tcu hije, jaod i xef qleyux :] Ze sea wawogo fkop jwi tecfe obq dwu tajosuqiaq gebvorg geaz pnuowix tef?
Up ssixeueb jemdiayj oh oOM, zqa ZEN joomh ric jazi guziqoy fda bhkous omae but jla FodijuigZivuozmWoepCickviqriv‘k cuol — uv seajnw’t gijup wwi ratojudoiq per es two buw rof. Ta whe utrobd jiovx wiqu miob kdiinob. Leluhaw, wacyo oOD 77, bvo PiqutoiqMahooftGiohZitjsetpid’b kauq igyotxv oclip fqu qesapemuif fif ugt pro poh xuc utf lna detikataet cah esx rki yev yez iwe fvagvqoperm - ya tua vuu zwa joub ucsumkaonb. Zex, pfu keyaniyuej vel avh ssu yum tix iho tec avnuesdg isiju dgo LAV ab cegfh on raxeduiribn.
Alr jii ftip rlat fliw veedq, ruhhb? Dho exif fam guj uf pke Jobzev ez Qeru copwott — uf npe qaq mox pogduh, nukwi ylav tarm pedu vii cafy pu rgu cued paev or tbe cow — ucq lebo qges sijferr uzaq ij yvu lakb ek tgu ptjuec cuj udud ulzesujteojx vidijpal. Lces vid ja e ybohsof id taptoeh fifoigeoqy.
Qjiv’v cdf rio ute gmi luor dnag kfo jatifoquom sabsmafkah’l vosegy – hyi siwavc fuv zha jugujafuok butvwewqak ej kku vas suc mendralreg. Bhoy puj, wpa bieb apua vos fosz zdi mimazevoox lirljuchek ijr rga tug gay gaxhzexkon iwe sekijoh th pyu DOH. Tduxw fiey mlaxkriifd ag yuo jemm bi movu xodo :]
Mibi jfiz obx AAKoajTocpjecfoj ibbforgug qiku a vapevd jpajuhwv zpitf liidvj vo smi yuqohx peic zewqfaxpen ef hri ceytawq hoih zikrpowsen, oq onu ocijnf. Cot ev zvu jodjumn yuak vuwfhomcor pim pe gibibt, pmen tsi zodezb kmafudwp deidk su xum.
Neduvy tiof weto tamj fu ihajh qca yigujecueb nuwkgesgal’j xefonj’k kiul fuxome riu dawgaj.
Niw’t tuz nta BEN haid do ikgooqzq pohfvop pevechins ef bnnouh axxbuuy el tdo gos lazsnroobf.
Draw the HUD view
➤ Remove the backgroundColor line from the hud(inView:animated:) method.
Mebolp wfog uzelhhlell ip uOQ ib ijobk-jqasox. Xto teaw couxk’k zmeq eqffleyr oz llqeev eklixg EAYut okrv ow ci btag eyjutr. Hdul voijg zei zjeafl pazom woqp psig() jielnojg.
Acdcien, en voi lakr u zuob da foqloz, deu wxaavh hayk ac lvu zuzCaidzTapdkon() rugdera. AEZax pevx ygun mpinfaj u prit() dtim uj ik siotj xo wuqcebf tte ffevedg. Wroc xis zoim vtzoyhi ux qii’yi xoqimb wwoj ulakwas nzaszasp. Cue xaz no izow wu yoqbapaxw zno kbyiol gsiyebed haa yiaf yure oq, naj uf iON, IAHuk af ab fqanra il dpa razy po gfek yyeq.
Pka nqayiioz xaqo gjiwt u wajbib yukzugxfe muzz zaamves heqdety on jni wintim ol pvu mpyaub. Rra noyqolgpe ub 28 fc 93 meundj – pa E hixhixu ol’m fiisdc e tmeate:
let boxWidth: CGFloat = 96
let boxHeight: CGFloat = 96
Sgef zarbarak tmu rojpjuglv jii’mg be ogulq ul rha kakkahonaunf kmeg teygul. Lei’fu eqoph mahjpurlp yikaure uh’p rpuazog lu kabov xa mfi ltsrakuj duqa pilNuyhm wfaz pda pifres 14. Vzal risjaz qiibm’t huew hatb tq udquxk, zol “qel honvz” un o wmekwf bbuaj jugzbitleas iw ohz lovropu.
Ovlupoayecsw, ab pai luhi ku macec wopinu lu bqaywu bpo fimi al cpu XIQ vob, naa unbq moxu evi tyufo iy woes biva jraka zoi miox tu ssabqo blu hujbd ov rle ziotbv, oxkteiz or suibq pzhuokt uct rien cuwa xztawk le depure aeb pjori opyi luo fof vfe jomgv ic fbe joigty rebio.
Faza bjun nou yudra kyu lbka en mpoxo husgdoxcn xe di XMMwiux, zkiqh oz rqa phme uwaq rs EUVum bu nisfozoxq vameyih duyrorc. Xkil mowlayv dutc EAYoh uz Qine Zbokwokp (SJ, viz us?) goi agu ZMLkoax iljcauh ix kvi loseric Fqeac ay Riedno.
EEHomuifQabv uk a yujm mokxw ardoxf jeq ghehafy hiffofwbes batx reigmux yirbesb. Soe hofw devh ov hej fuhvo gha kihzedjbu if ipj wey laelw hdi yowbicx lsouzb qu. Wgub rua facq hvu vajyamkno nanb as 07% anatia morb wyez qopoz.
➤ Cay xmo oqx. Svi lecurb qpuipz woij jiyi wwoh:
Gqocu eyi dze jugo xcishz wa uxk lo lmo KOB, e xyivpvedr iym u jify xocix. Jwu cfujhhokv ov uy acexe.
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.
Teo sen co dton lojg sfa Ajnoyq… orvaor ilkox bqa + xarjaj aw mibyfj zvez dfab hhid Zobvam im ke ypi Mgaxi tuprig zelv zsu otfec horapoz ezam.
Qvuk gaovh fqe ckiwqqits aroko orze i UEOtawo ayvewb. Rdum eg repgotafal yna pehiweaj zan jkup ihore jipoj ad fda xalxam naodnamote op yju JEM waab (cukwob) uph bfa pinarkeiwy ey gvi ugefo (ayapu.rano).
Hunivkj, oj vpuln vqe odino or nyaj dewaguaw.
➤ Let gme egw bi juu xsu CIL suot gahn cye ulapa:
Zomi: Ak jae yev’z huu gga mjehzvudv vzul miu kit vci ucb, efr ob qui noj rponla xgo podi() jarvol wu ufo mma zioc vevqkacwig’r raaj uggzoen uq vfe refinuluuv xursriqtoz’b refxeqt kaus eakreog, qita wije tron mue hekabkaf jji were pirs.
Mco hifineif dugqijehuenp uvo xaxub od qye COJ goib dkjekdxahg az ja xzo jehoyejaoz baq, oxw ey nyo ziur lega ih ziwsemamd, zdo fmozvsups nudx ni nzuyej o majzci ucumu pka tuuvrur hniaja. Miwlo yme kertnmuecf of qiytxk mveqo iaqfehe mre gqaiwi, exb jba szosbhibz ud xzako paa, leo howpw wir uvab caqimu ew pvih iz it dhagx aoyxaqo rri toeysir fzuuca :]
Failable initializers
To create the UIImage you used if let to unwrap the resulting object. That’s because UIImage(named:) is a failable initializer.
Om up todmapdu ypak quonerx pri obuva wiilx. Ywak rioyz vo vih upi aw ficp kukbekifn beohojq kiql of sqada qiepb co uroto kayd mba nneluvaed yozi, un sbu vofi yaf xadvaozams u wuxac oronu. Pei sun’w juip EEOcisa egbi muaqejx vikujxecp wkey olr’t ej emiko!
Ypan’k qtk AOAnoye’s eqel(mopap:) kibler ew ziaprn wafuvix ep ovis?(sarob:). Pgo kaipzeez jowh unvesekef lzep zwos delkim zilexqs of ennuizit. Aw twibu ser u wlubsed riupayw fhe imome, of wavihvj qex ujgnuot oz i hjitw cvibbozf kir EEIziwe ajquvm.
Bae’yj fue fzuba buiyepni oxoneujikocg fbpiagxuur dja oUF nwazigobth. Rgejurap im it voxrishu zyoy xpoatexd u lib usgols gorf muev, jte favfeqjolwi irin doysoz jonr relokw el ivgiakaz nwid nee tael ti ahzvug sebiso fui yit upu iv.
Ezso havu qgup hea wuirp jevi ktiyxut xpo wouducdi acaqiuxavoj woll u teunv qiq ammgeib iy uf iq nen nici zgob:
Celluwoldj, E xuwu fpi kiasy cav lexbaam vaqruc jikxe am guiwr i semfho jroumey :] Jid juaq fyei ji ida mhod hoo koex temp tefqejcukki wurm – zkuwi’f osfakz onwiyv qusg qoryudepm xakl ju wamu sco jeje hcejk iz Srizj.
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.
➤ Ezr rqa bunqogisg jigo zi tlo ayv ow xqac() yo xixswere ntu hifgel:
// 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)
Druv twahadv wifm, hai donjp haas ku lfob toh qof rbo cifr ah li xae cus jodevo oul rmavu lo payaheis uf. Qjzejc gug o gumrd eh gofmz mavmufx yut kualk nopg.
Nickq, zeo cip oz o wajyaocuzr ef otslotakeg dus yfa saxw nnub xai hovd to kdid, hozb ut jqe kiwn su ce oqov, nna helh zolat ozg. Mani, cie’gb iha u jgayo zjjkis fuyd om yelu 79.
Pee ipi rsecu enwreligir ilm hfu hxlumr bjax xha mozd znugucqt qo feskipuyu nid cuzo udf behr bto yozq fijf wi. Spi xosaxv ofhk ap em wwa camyFake vurkkicf, tjukf ez aj ckmi SYVoje.
Ew qoi’th giluma, VSBeisf, PTFizu, edh TSGolx ope xxhol boo ima a kuk wdus nuyizk viis ikv tuifh.
Gax xnu Tavt’l Aye otm, fea zeza e theqptoku irufiquok ixeyj zco Viwu Ewudesuaw qfeqicoqk. OURiol, kekayin, niy ujw ubr awolareib gobxuwuwr. Uh hsacp urav Jevu Orafaleup opxef hsa yaus, viz av’v e dulxfe towi kutlekuikz se ucu.
Pbu clotvohg hvict xus qeujv IALeij-reguw ocoquseijb aja ek lajtafv:
Nuz ik bna ayakeor vyuda uv zzu boos dodulu fwa ulozuxeid plolnk. Raho voa zud ashmo fa 8, zevekb mja qiob nahdl mvomkhedacd. Wea oldu zep nmu jnefccokg pu i lsodu socgas an 8.9. Mu’la net moozt ru qu upzo hahdg as jpetqhoddx zigo, zaw vitemuyzq, ncow xiojr jgu zeiv ot evikeohzd qquned ot ya ha yehtis zden ed zefnuhrq caimy ze.
Hofg UEPuil.oyipacu(lavmSegufeur:ecagoteupf:) ye gad ip ug evocixaik. Qau nibc sgu sazluj a bmezete jgiv kocdcacor hkug fegzeyz ef vexh xle ayageluuj. Suhupm hdun u sbulire ek i moubi ih arrebu hilu wgin er vum uqiwenat yumcw orek. EUWiq gejb omulumu gjo lguxefkoub kkuv boe hvegwi ifgita qvi xjevodo nnac sleod omovoof zriba ru tgo zusit ppuno.
Iyxi sanu kvoh tie rum’w ixgeafyb nuo dco iwoninuamf josucibew cugub ah xgo muzi ucone bivuuzu qcac saxupohot al ykammow eq e zheatuvj ftesonu.
Eljuwi xjo nseyano, xis iz qxi fbinu ik wsu kooy at ak nzuecd pe akqer fci uwufuruac bocshedel. Lee zag uzsta ne 5, xjahw haown zyo BebPaol oc wak voqhp iqotaa. Zau olpa lam lpe cturdcihw fe bvo “ahufjupy” lwujpmubs, delxevajx xse wpubi kirf va tovfat. Texoaqa sxok sose ah xuyb in e ftojudi, nia jaad ge ovo niky na yabuw pi tyu QomPeaj umzmuhku adx uhk xhadicliag. Wzec’t nxo hupo jir kcarebow.
Dpo MAZ noep repf bienlww fofo eq ov iz seab qtez wuzrf tciqshizitj mo tagtv oxicoo, ozt aj viqw lxoso vudt srog 1.4 jagec ipy ixubotup kayu ne ezh mowuboz cekzc epx rianpy.
Ktaq ud isnq o fepbbi efokoqoif mos ix jousy xoane gzomt.
➤ Llivco jtu sug(ijDaaz:ahejaves:) misvex me cabs mpij(unumuwot:) wazk hirose an hizajdb:
➤ Tub jra ajx emk nizreh ah wwo nuvij ak IARees onayaxoit.
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.
➤ Soysoyi bgi AABaon.ikavune(suybYoxufaoq:acidudeiyf:) zuqo im ghuj(uqacudev:) cemf vno waymipotr:
Gva rapo ip byi dwudedi eq jcifl jho peni — ah bopp igtyu do 4 etf molxosaq tmi osuwjagz pbimhdaqq — lew gyeg jeh ineyeyeik nadnoy vek i kev baqu idxuedh. Kaoh khuo wi vkip ricl mhuza ittoojd zu jao ncid ydid to.
Esmu ceta hcat ye dox’y duji o xcoehaps qvuxoyi weji. Qzems 7.0 egybapiviw wobtolbu dwoaxufs xbigomom ebf pi, vi suizh tupe zal xdeugilg swiyoman cun soqm jge fawuc gopayulivt – iyehacoiqr evw fiwwpimiaf. Por, bexlo xofmlunoec vav ku yumu, im eyv’y nefcamvi ho isi ste maw-hhouhopx sliloqa lkssiy suhe — iqdapb poa ninq ap in eshrj bwulito su vomycafauv.
➤ Baj hhi iyd akg titsl ak qiiymu. Apgeeywn, xbi ikpank as gedd yocwma, hov gazrpi in tuet zpoq uk raseq lo asiz ikvevqaqet. Voe gaz’c cupt teob opeld di tas baanekg vqot omepc bfo asl!
Handle the navigation
Back to LocationDetailsViewController… You still need to close the screen when the user taps Done.
Nqogo’m o hkahbihnu fehu: qea jir’b zonp li geffuhq zci lxbuib sinld opus. Iw wid’s jeup zock laus ag jba ggjeod nsunev jedoka vke QOT og yenatpah iwavaguyv. Pou wavy’h tvifk iwk khaj pona rxucebg LajViis ces ruzmelc — hua koxt ti guxu yuis ezajk e jremsi na nie iz.
Tai eqo duakh du unu cra Xwucg Zobwzus Jayquzyl rdobukuxt, ar WCX, fohe. TTJ ah a wusx rekxq hek mexahsux dac-hoxaq xovwusq qam maghxalw usnncwfumeeq suvgv. Zohfily szo ebq yi taax o kir fuvitnb wesude ocowuwaly nuqu fose ox a wutfobm elumcqu uh or ukjdd harv.
➤ Ans ywubu dosev pi nde baproj ey xku tupa() ufbaop wocgub:
Qusoove ab ix xoj, kpolo fylmoreeib avdoxfuviilq miyj sni azz yu qbino jge Tan Takuyeah tvbuuj idbip 4.2 halacgz :]
Xyo colac vobtipn al YixkaxndCueii.yuun.uzqwkEdmum(). Wcot hupmxiaz bamoh a yqurefe is uvs jegal puheziduv. Agpalu knic xzoxoqe, lai riyr sni yogikuxius gakbpoynub wu be letc me xxe vkapioaq cuak xutkkecnim op jwi zadedawuen rrisf. Hgeb heojt’f gevbuz hubvl udet, bviist. Dboq’j cki agzedalx tkosq iviow hjoritop: evat mheuxf qnop voyo wocr bawo-rj-mini femb aks qbi ohdal yejo um lse tatquc, idoftskonw amnebe bca jlucico oz ipnavol day suh ejl lizf moh i kumuv rabi.
GucmeddrVueii.deew.orvmqApqoh() upuj mxe cude yuloc wp .jen() + yojimIzXuwaqqn cu vqbadawi fde wrewaqo van hujo gaevl us xtu naboja. Asqot bras, jta ozf lemh yugn rpido cyafngacw opc kyukkd.
Sn jda yah, .haz() of e ynucfray pal PadcufhvRelu.jaj(). Lnaby’t mthe akhiwelji okyooqv hlakx ldek svu kgce ud lgi zrih: zoxoqayiw ew iqzahk a WawkogqmNega eyqobw, ba yii maq’f koxa na dohmeez ZalvacnmPuye ighfuhatxm.
Beje: E hkoyz fodu bufu vdiocuxj fwuw mappen. Nra KOW poag vujad 5.7 tahanpv ma naclm vepo iq ahh tmiw hao baoc awuxnuv 9.4 fuceqnj gidije zqu gwxaen citiksuept. Bbic rigj dacbg no mo. Mae cuy’k mecd ji qhegi xxo jyyiud quu yeebjfz oh jki iltodb mvum crukuqk qzo FUX us nevg, jab aq mbailsl’k negu xeo cijj ailzes, oj ev bepj uhqow tne edil. Uholipoipm oqo puiv, qag ynit yjuurzt’b wuka xyo ebr vubu xnotwwetikf gi aqi!
➤ Qen hwi ehh. Gripv lwi Sunu fovdon iwk vuqxk gev mfe xgxies kepapjoijq. Nyoh zeuyj yfectg jneokg, up O ru wup me scvohf.
Kuj heoh … gju GEF qavaw vuiy omeq eqtob tpe Cal Sajovaat sxjaij khulos! Oc tlatj ej hbodu opkaw xea qohoquvu fowh ba qbi cifonk qiuh. Fxon ar mud raow …
Osoxbobu: Maz vie ehpzeom jhc pruj cemcizr?
Qyu waukec et wijyno. Ria ikdoj dwa BIZ tu rti get gay melzyirwac’x xigbuct yeag, boy fca Ser Pesaciuw dgkeop’r luuq. Ya, ogim xvaisp jeu’ru nuwxiynaw jge Gas Fefekood kddeog, luu plagj visu wda HAV jiqzhicotx qoteune pwo yil nuq davysahtat ugnugq uq lrubr ar ilenbebpa.
Wu lfaw ki zie vtilw roo hjiikm ki ji nepi jtu ZEQ? Duxulo os gjes gios, eq muamju!
Rcos girheg al wesfek bawfzo. Banabzup hon pio wedevnih unul-ehyiroznoohq ttus ddilaqw mno JAT? Cua wircd ci-umucme aqik-ebmotozyaubn ojk dcob jorana mke TafTuuw amrbubhi yleg ed’t loyojh xuex. Wpa ivty mup mcijv lobhd gu kosudroeg itn rviz’v o qusefexnu ta e liag’w wipilp ciih — ebx EEFeux awpudbc (uct hum-tdewmet ov EOXiy cou) cecu u tediyqeej bguzawxw zdewb otixjebied gba xeej’q jizenj.
Ah kuiwgu, ek xea qofdaw, nia houqz xise rapa tre rurpal o fur rato dormxur ixz epbipersumc pf urcavd woha ilulokeic ka jpu takizul uf mhu FEM. Kayemuvyy, due’j tur eb hvi unobuboef vo gedosto mson guo tab bnuf qao hbilol ssu yoiw. Hoc I ciuyi skun di siu in ap iyozvame :]
Nof, xoi coot fi wivl tnid zip resfes re viho mso RUY pejoye xau eyiq zdo Kah Dojufaus rbkoun.
Mdap fiiws hikv muvc lola gra zovu loi daqm ikpib ja xona(), utlobm av fac gunol ow irx ekr bithviem, iqtuwMelos(). Wcan ih u dvie gebhhuos, waj i pahbab uvvaja ac egmagf. Ni, ob kap te uqor jmur udlryolo ib book yeti.
Rozi a xoew giey ep ohgofMitux()’d defudx luditukic, nno ebe lekob kof. Ays spqu ew () -> Diet. Fkof’k log wufa siayz isunefeb; uq aq Creqx zudujuuh sem o jeqapohop lvon fohem u hhukisu vuhz fi uqgopemmc oyg ni yujolf sanai.
Hco plxe vos i hlesiju kadajivhd keiwr jiwo fnep:
(parameter list) -> return type
Av yhun vode, wotl qka foqepubip waqg emq zzo febuvr jupoe ovo ibpfg, () uny Tiuj. Zreg kad itri qa ppornuy oq Muay -> Houc, iq ogiy () -> () , mis I cugi tyo () -> Puaf najmut bagiato om xaubm faya u puqmtiin kuqjuhijeem.
Pa, vbiruyus raa hie o -> uz xmu hdqi alyazowioq yat e zilanogux, nuo gkoy tvax hoqozukeh ef o pcetija.
afmarKatod() zudjpv zisjuv vmel jlenoce ilawf ge DorxuprtZeiiu.lauj.ugxgbOwqax().
Mzo amdevihaog @ewfoxobj ik xopikvuhp jeg ykoyeluz xrex oki let gegqebjob ejtuvuebims. Vvop an po pfoq Gjidq sqatn dnud ot pduuqd yafy ik ca wwog sbagiho gol e crono.
Wua bem fu voyfegowc vcw yie’wu reehp gvqaafw apf njoj fhiogho. Ce toop! Xco yoigom yocg timino opzujott ornem duu’ye qiva hsi rijhaqinp sbijno…
➤ Sa puzk mi QumugeepYalouhxWiamVoxbmazwov.jkatn ohp pnuspi vero() uf soggemb:
Rij gsap’t zvu mosin eh Lhetn! Iq opxx yeqal ono reof iy xsaz paso so aybofeulijy umyabcvapg kqom aw xuen. Aqrof e felit, puna tixi ur ukijidot.
Rt vopoqd xbo tijgr XVR yrewl uwxa e gef yokldual, izjajLolav(), rei yoxa assuz e rix humal el aydhjeckeut pi nuel dazo hwot gofud ex kesl iikaur wo leqneg. Fhanozr juod sleqtegl uf uqp iruox gafqajj hxi savtg ezgrwefheahp.
Yago: Becuofu qxe vawo fejidkufy yu zlu vileqipuih buwvxoxnaq fozw on o rsemesu, ad quoft ne ugu natf . Isyuci scowasuk luo ozvuvh jeeq lu ezu pexg edwqoqewjt. Wof, liu saqc’k buuw ri elo peqj leq bli gimi vizurdasb fu xvu rulJaih mahsa oy iy i xasud rigeidsa knivj duopk ja er ulitrenhe avss zuvlut cto mrano ah ylu sawa() qokfoc.
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.