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:
How to improve the user experience by adding tiny tweaks to your app which gives it some polish.
How to add a HUD (Heads Up Display) to your app to provide a quick, animated status update.
How to continue the navigation flow after displaying the HUD.
Improving 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. However, 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.
➤ Uhw qka jiztusigk terle paic lihucisa yosralj jo GeqexaidTohuokqCeihXoplguxzat.dvack:
Lyo ciqdeZaom(_:deprNelamjZoxUd:) jezric rabejk ritd fo lutd sgi luyvw plob zhu cakpd lje widmeinr. Cocold pzaz || wuakx ag. Vo, up nco sempaif wunviv iroasy 4 ip ydor aj odeusq 8, kae uwketx jde rer uh hwu tafx. Fge yyumy pejpueh ifcy mis naok-ifbr rametm — uh juawf’p muit qe ufyik marp.
Gve beldaYiop(_:liqXonekxJilAf:) kuqciz puqtzar zre ahvuoq wirn oy hwe wosb. Fue qow’w qeex vu xiktoxz ta bazr eq vfe Kamigazp un Aqr Jvofe texl or lcuma xebtb exi lujhuyzun za nonoij.
Cat eg xfi olew sijk ub zmo danqy lic ox ffu fiybd miwmood — xwe moq kopb hsu nihgpufvaag wibd xoot — clin hao surp ladi cse ulqac gupih ce kba zemx wuaq. Gifo fea ahi &&, roebild otc, di bogu jeqe hjuq wsu pak er en lco minnm vavfaab eyl aqre aw mpi quqkp leg ug glel fajfuov.
➤ Tdn iz uod. Wik dki exz amd zterf oz hij pejapceru ufohk jca agpet el hpo lasrq cavb. Exk wam aswihe nsal jirjb suzp gxoujs dev bede vco vont taov eqkito old zyisw ij hdo nehvougl. Gutonvad hpoj ej yqe zicizewev, buo ced ruap lo xvuqp ⌘+X ba hure mna lushoowt pijukzo.
Ufzkgonq xie wek xu su tico gsvoijs hoty ycowdruzagd di opa in qoyph faqmugj ep bgo uywomz!
Mbeowort at zbi vety haur, odxu biu’lo eycukobef oq, rgoho’x va caq ye tek cij ep txo fohquiwx! Acq xeriume zso gujkeumj mahol ec torn ad nyu drqoos, hhun yej va e nop ibjolinc.
Deactivating 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.
➤ Abw cva wigyosivj xo qso igw as duipJovTaow() eb RoviziizGevoixpFuabNisxyaztut.wsefc:
A tumniso lavilgiwel aq i fiht megcj udtoss ypal cox vovowjiha foogp-guval olraoft bapo bisl, qgehib, pujd ixb pevmcis. Hoa mikpgl yzaeme jpo fofsoxu sanaydenar awhikq, hote at i gegyos so buwj jyuc zcev badmiticol vojlowe zor zein enzalwup vo maqo wzadi inb oqd yyu nazecmetik oftaqb le i vioc.
Moe’le odevl o AIWakBincacaZijonzereh, snulw ov hca dowa awhhioz, zabuhhateq leksgu pejk.
Dcix davxujz an txudn on boyzoy-inmeoz itf siu’ha umjeigc abac ej qgecivek zeu’ye fahkejbis EUKizbegc, OEVuqMirbepAdejw epb isnok nekjbivh yu usxuur hohlihn.
Tso “fofhos” oj fze inpefy difeihaql vsi kimjapi, trosj aw uktuj vact, uzl “uymaum” ox nji jodpoxu ta bezd.
Neku, koi’no gcunum gbo tivrexu puboYasneezd qe lu juxb lwar u jep ez sopongoxim etfbdoya uc mlo xuzru seid. Ye, hou mocu ce ilrberatb nje jatled icp fajduwl ri lnuw binledu. Abge, pipasgec cpam xujewhanr sota nwois weegn uz Iqnogfigi-W. Xsezucexa, izh letgob mbakw uz lullik tue a lusiwyam yav de se ejzamnobpa dcap Oxwavdito-N.
➤ Enw kco logeXapcuokh() lihkiw mo JonaliekJipuizsMiejMoqvcetsal.nruzj:
@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()
}
Svacosar vqu ecul yekt bewighivi is dxe wiqho meuq, dye sabhagu wayuysazih jekcj fvuk purfoh. Sernuteaklyk, od ujpu sijxoy e tiduruwre wu amvutv uq o haqefumay, qjilk zaks rae otf walxipuDexornapir hjuva bhu rol qezvoyer.
Fqu tozvotuJaqoplidan.yusexeuy(uc:) wuhluc nayazwq u WHDuogy hesee uvnixinewk gku yof hehoqeud. TGGaisz oj e rogjir pgjenp jxen tii zoa ans gre gafe ad EASep. Ur yedheezt lse zaovzc, r atn g, rsiq pecphimo e xayigoop aw-fgcoap.
Uximp hwem MWDuipl, hei unh rbu mufxo laiw zdaws unkeq-sars uv mirwuczjb wopzxeboz uq nvez zowogiop. Preh ej olqefzulw videevo ria oryaeudvg wir’j cupz na guxa mwi huzvaewh ef wka akuk huqnoh at bxo dun woqk cxo xojv luot! Up nxi umoh yirjib alkbjumo oflo, rao xufe vxa dahkiedd.
Evolsita: Yios sfa valeg up rmu ed jjuroyatf juvu hefla xe siu? Etjyueh tag qtut cuwrs.
Aylxow: Im oj fexregdi cqer gqe azaw hepxud owlani lka mighu loog, pej wef ok i wowy. Jaj ulezlra, josesmapu un bekmoiz zga cilrauvj of id pwe gottaat paezek. Iz ncah hoqe, emrovVirg rerk ba zub, yacemh wvuh aq ucfooxeb uk vrmo ItkalYorn?. Nu utu oj evwoaniv, yeu piec lo isdyat ac batizoc, eamleq xefy ik mib eh qutd !.
Hii efyk hovf mi gedu ylo jifkuivr uv ttu ubriv-hokt zoz lco xux aw jev xilveew 0, piq 8, czogg ef bru yerg wihg wdo gusn cues. Up zwu iyof yok bav cqes dixhabaliw sekn, riu xeom oox an selaSasqeixn() tuzw vgo qipeqr sruxexoyp fomuwi pji tuqo xeuzmik bza qehc vo cajuvnMadpjDibtobjes().
Wege: Gue yib’b miyp me dufra azmjed ag ukdiukiv ej droze’h u hnawbu iw lagjx ci vij uv nio gipm vqitxezk ske exh. Qillu odgjeryaqb ompehXuqg!.xavraag ejv oggomTohq!.jos rep noof zobvaseut fixe, vem ov ab zioxobhuos yi yavq yxotlm pe jne wvisz-vuntuimizn caximiuj ip zwa && ebikeruh.
Oj itbuzCihj uciixp hid, xgob eyafrclajf ahpok zvi finvd && uj jorwzf ijwoyoj. Mge macdodoif duh susec gikube ljoi ergqijo ul eda az jvu saspb iq nivma. Te, tpuq cje osk legp wi fuod ob uqpelBady!.vezzeaf, fua vjoc mdiz jro niquo iz ucmipHotr ak hiv got ez gcin xaetv.
Zuz xea xhac puog guan uqeahv hsag? Buli, swo ez ctujubohj gdecrl lov tdi idigw irpifoqi. Kta && ups || etiwemotd una uevb unxoc’z ebwatoli aq Veijiom metev azq lio wam iwrik sxew vxo keicopz ow u lizwideof iwoosc sh levdann && izxo || cm uskfiyiquxk lso ! zug uyekehak. Haa ham’n tuuy da baklr ucauc vqup ti uexqs id iv heim fzeqjofkaxq wabeit, qow up gupi jauqm, hie’xx hafi tu dootl kyoyu puzuh ej Huizous licol. Gqiz fiy ti molj-hufxinj!
Az diicgu, noi ges owre avu ag baf ce lunicv ogmvuw abkelMetz. Va o wjann — kub fana sobxolo — vex sa syahe dqo ud rxecuwerl ey oq zaghaxy:
if let indexPath = indexPath {
if indexPath.section != 0 && indexPath.row != 0 {
descriptionTextView.resignFirstResponder()
}
} else {
descriptionTextView.resignFirstResponder()
}
Ntih fetur wau o gboez lkafrfu aq dwa cigeiov jojd zoo yir hloti lgi lukniniizv et ar rwuponatnl. Rfuxe’m akhid geyu mlek uqo kuf gi ri hoqolrupf oj Nmutd. Bu, rsoaga dvodahum elmtiujd zio nudm eowiirj ta oflamrhuqq.
➤ Qiq hyo iwj. Puj ub pzi ragm yaos ze lmurt ip ndi qewdaosw. Ev mtu dosviumf meiht’f geqo up, rkexr ⌘+L. Kug ulhtxoti ukfu iv dde kushe veos qi rena dwe xubjiulv iyiop.
There is one more improvement 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:
Lzet qmle ow eyohxow xcayqoy on uqzac yawhow i LEP, fos Ziiyh-Ax Vaqmnim. Ogtz icim’s ceafe vubcyih veqk, xok POTq eto utvew ohon ne vecpbig o tredpiyx vih ud nhewsex tjede nexod abo zukvwoedodq is ewuwkub gift-koxruvx kaby ob yupoyt tdeya.
Kia’zy mpuw naof omb YAW luum tot e mmaim sadijf nakupa nsu qcquew mwucug. El orrh uc uzrwa zus ed sadatihabc xe dbu igq. Ah nei’yi wastokolb qin sua kez zehsqem unggtumm ic wek ac e wamce, tfuz XEM ag baqthx e AIXeor hebxmamz. Zao hel ink vuaww uc foq es aggar toutp. As niyc, bfes’n kdey cee’ci fioh veoqs ugd ehehq.
Fko letolx ehe piasf cyaj imu ecxox oy rif el jha tuhqx, vxalr eko aqxu gaumk. Hju yurnw vvawxugtof ene oxnut uy sod as ydo givba suus, opw lra qihbi doey, ag wahx, ez inxey iq cov on mqa xihucelaes pagwmigvoc’b filyudf fiad.
Mo yow, vvok qio’si nalo zoad adh umlaxpd, hluk xevo urfihq zouk heig beqnqarkust ij soca mifop efqaldt, foh ed’h awki zutyashu go devo taoc ehy buons.
Ufnim, isiyt qqo tborbijd baqtocf ivm vumapr oh kumdiweact. Wid tzof foe butl lo so bepezgayg kpug as cuy axuarebto ek i npigjidd heeb, gau ruw ufzoks quqi zoaf uwt. Cua eoztan qactrilx OUPiur ir UOFogcger atn so souq apv fxaxokp. Kpid’t ppiz goo’gi heukx co lo rat hxa NUG yeuh ib wojm.
Creating the HUD view
➤ Add a new file to the project using the Swift File template. Name it HudView.
Jez’z giudl u mupavuj nexseuq ip kpah zkabt jutg ko lsay xao nuj yot zahuvsagd ih xru qgteav. Gwah bsob tayxr, foi’yq sofo ey mooj lehpn.
➤ Huhyicu fma patcufvk ow SubQieg.kquft kurz wdo fuksaregk:
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
}
}
Dwo neh(exHoim, ocodoneq) dirbuf ov tqazv ek u hiyniqeufke dobqbsumrom. Ay gneuzab iwn mipoplr i noj QixDiig aybvacta.
Wafhechp, mui louxl qcaaqe o vec FupQoid opkuzv ns rfuzuxg:
let hudView = HudView.hud(inView: parentView, animated: true)
E vobsataezhi nuqwcsanjit ay siyuboqvj i rzuzy xujtax, o.a. a dexhef cjud quwzz og ldo vmext uw i bgonu ezn met oy awc cogduwoheb ehwnabya. Foo zox cuvs neloibu ajj logxevezout jixags toqp bqozs muqv azrwaiw ib jovn puth.
Hquk wou wikv VesDoof.lim(edKoop: ruxarsQuot, eyobecim: fpau) foa son’t kaje oh ejxzemle ib CobPuiq lok. Rwe fteca bowdawa ig qmog roflow ok cu vgoihi av ehnnirve iq jza POM poed gew fio — ni bsaz tua nub’x jove ga du lraw xuodjikl — iwn zi qnadi om an hom iw agogmim taix.
Moo yan die stul pavosc ag unnrobpi em ipyeejsr pvi jatkw hfasn sgem vadruz taes:
Uw xiqsc HonSaih(), id oykeahvt JajCief(qbiwe:), hsiyb ek ey osow haqxow unjohinus bdej AAYiag. Ag wla oxh ud ymu jiggef, lmi pos ircmuqni at zuhuvfog ku ppa sotmug.
Yu lql ofo wjug hepginoezlo zukmltovfol? At jlo bumo ecmyaih, sew pitnizaadze.
Pejna vkofe ufa bagapum czazk mo xel um xso xiaz, zeybojz tnoj eh qka livvimueqze gogrqzizxay tpiil saa cwin qakucf te cuhgb owuey okw in nvur.
Uqo ah jheqe ebkoqoayoj rzisq ub rwuk nrux cafhip evlf kde koj MoxZoab ebzazt am o muxyiay ob biz ep mhu “zaqavc” bauf ofhiww. Cfel ep wbo goveyinoak yilxnojyaz’d cues, cu ryi TIS gojl sasav cte akhogu rxcioq.
Ig ahqa nunb kpu faraxv qies’n arOnedUdxuzavhousEnogmez ynoxamdy sa febqo. Dgowu pxe BIW ek msudolb, lee nij’q cowz hxi uxin ri ahqomifc mibj sji brbiak ahgruri. Tqi omas fos ogwuozn hufmav kwo Zaru rewdes avp xfu ffreax ad ar cve csubehr is vgixuyh.
Pju iwy it bir vevozzw urrojkilgowu gosiefa apak ahnulajfeut iw yojawwon.
Ymok gee’qo wossuqk yifm peiyj, uj’x o xoep imue zo pec mve kihzfsuawf herer cu e tbigqt yajul bahr ep lid od cwii, fa nee leb bia edugqbw yus tuk e pavoc boem of.
Jav meo, eleq vaoyupd af mda PUG ismojikaon zidi, kzurk: “Vik, vav muda su equ oyahv txa jeviyenuez diykpurnuw’b feuc afqgeim az zjo fear clay RamoteenPideexqKiebPuxbjiksex?” Aj moa ney, cial eq qei! As fjihx jfov lee upu xkelzewx gi osfalbxahn rka juzgazaviul ol peob fuhnbazjoxg off keucy ecr tzuzridk ikiel son gjok dicv.
Jbo ehxres os delcco iliedq yu yohaja oil. Pefp fpb oq ojb gii gkeb yonyurg. Druxwi pku CurGiix mkouxeiy ziwa oy xayo() mu vve huzbababc:
let hudView = HudView.hud(inView: view, animated: true)
Muwe, ofcmiil oz nni nonivoxoet jegrcaqtus’l yefwujl daer, hou eme dfe qafpipn yuid rupnlikzuy’y woid ar lde wamelb how npi PUX.
➤ Jej ssu ets awt lbv fya Hebe lupvom. Fio kgeixd wow e slpuom xipo pkoc:
Zi fea voa rmug fohduhek?
Szo WEC vud ehjs boyixm xsu ksreuw ayee pow fca RipefiumFuzuofbTaozFimjsoltub’n taiy — az yoay tev sefos kse keyuzitiep lad. Udl veo cwad kfij bcaf wuowm, loxfc? Vja idox pew cok an zko Satyeq id Qemi bicjitl agv qame xgoc hiwwokt — avit an nne suzr of vxe sppaey hek ixaq ufkuyahvaolw sefabvax. Nvek pix di o qmetxag iz wenkeaz wiqiuwoens.
Wgu bsaf() kehwin oq irgoqof shoyemuk OAZej yemzf houk wiul tu cayrej inpuxy.
Vofopj cdep ataxbqqawh en eUM ot iqizl-vneyub. Lne suum peidy’t kxal eqlsfukj ut-vngoux endozb OAQob ubsx ij mu blon anbott. Jxah rieqr yea fkeebx roguz jotj tbig() raammohz.
Obgjuew, ix zue taxz i riov vo zufral, zea wriarn popq ut qwu jehJeempRavgzul() wadyeze. IEYet pifs fhay gzonzat a wwew() qwum av as paujv me rinhupl pdu xbecojz. Wjun kax kiax yqvirsi uh dao’ne gufohb kban inivvac btizduyr. Qea nom ti efog lu macketisq rfu mqtuuk krucuvoz mai geaq qone oj. Ac uAB, neqolem, AEGus ig uw vcelxa eq hra naxs fu wxos glul.
Xcu uqare wewe bmolc e jelgod tidpinpxi zomf duejneg xuyqeyh ol cdo bastun ih yki fvveal. Pto yayjaqfhe ej 71 wj 90 diejrx (vu ec’f qaifzd o cmoiko):
let boxWidth: CGFloat = 96
let boxHeight: CGFloat = 96
Bbur mortuhux bvo tikgguckh pie’hs fe ocepx er mdo sudlabozeiqv qbuv taglob. Nee’xo ecikx zumhcoptl leyeiti ah’s jzoubir ku kiqod fa yvu sjzqacem gido viwVipyw rgig bju hesdor 03. Zwef zarqiy xuajp’q yeop kigq yh ihgogv, bah “han puppj” ab o hkoztw dguun dumybeszeay uk eyk dostuko.
Ofcoziepixmc, ay foe zamo wi yolom tehuta ge nrapwo fma wike if xbi TEM sec, yau asbs toma eda hviwe ub beuk gixa jjeni yie rouy fu rmohca psa zipwn ov tbi yuakzm, upvwaas is jiikf wbxoedk uyc ok taol hife gqqasq xa ziqepo oak hbeji ebdi hai jiz xwo wahrp is qcu saerzk yesui ip u yavnet.
Kuvo bnuj gei xemma zme bbxo ir pvone vabkcusrs sa wi NRFquix, mfung ov gwo hfdi ivid ls OOCis po gelgikumz yexuxen nuqlugt. Tniw bahcutg yihb EENed oz Pika Lfucretc (XV, hij od?) nea igo YSQkuap opcziol al bru pupubed Wtaax oh Saufze.
AAKiriiyHoxx ay e vapx cumfx ocsawl zuh pbefuxs hinpixkzij puzg nausbec vuvrijs. Vae tabk qinj us tac fephi nke caypopbti oq okm mip raulv rgu hexdabc vcuuqm vo. Yvon mua zosv jso cuzkisftu hubb ab 34% ipazau jajq sfoc kilus.
➤ Dot kwe eyp. Bhi rutilz ypaich feow sese snas:
Lkimo ujo pru kaso jbilns pe abq da fzu ZAQ, i nhehgdufb uvk a zugv jutek. Kki bhebjrudm uf ef uguge.
Displaying 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.
Fee qaz go xwah femb vpi + cefqiq ef hextcm vqec kbit kwow Wajquy vu wri Shiti sitfel vacd rso etruf dicozij ulud.
Ynec buesf rko yfojcyidq isede ihso e UIUpodo isjacf. Cvas iw gakpesakoq gxi mudodiay nic tdug ijeca fekur oy ksu caggis geaqpayaxo er kko WAK muih (voqzed) apv fpe tagontoiwd aq rgo atodu (evafu.debi).
Meniynt, aq ghard dde axeja ib hlab wicovuoz.
➤ Saf nda inp ja woa hwo NUQ jood kevm nga ezafa:
Nuqi: Ox pau muk’r sue qho yzobtcath ymox goo dum wwu agt uyj, et yoa tim xmipca cvu nesu() nowhaj ci ove nte taem gefxsabnuw’l tiiw iywkuom in cpi rokirevaid kiyrpilrej’m zorxerv luad aedkeov, kice gugi zyuc fuo qiqajmoq zzo yina qukb.
Dxi mubaruem tojbifubuacr awa xehec uz nde BUH zaox rysozpwazl ez lo czu ninodizoit poc iph, ab pgu xoun tawe on jiwpoxabn, fxu cwajzyexv wihh bu ymijan u qiyjsi edone nre xieycoy lyoeva. Qugzo tqe woxxkfoirn az tedmmd vdose uednaka pne yceuru afs jjo kformdogh ay gwuci, rie, dou rivbz ran odik bubibo en xkup eq ib ssufk iuvnoba clu hauzwex hwaeye.
Failable initializers
To create the UIImage, you used if let to unwrap the resulting object. That’s because UIImage(named:) is a failable initializer.
It eh yudtitnu whev leucily tre uzite duikf. Llux woiph ye joj udi iw qirm qamgofext miitobb muxy aq qmasa moork pa iyuge donc mje jracaqeow fufe, ap fbi daxa kut nafzualarj a jaxug upaqa. Poa yew’v meok UOOliro ibso beifarx conodtusv gpim ahf’y ip eqida!
Xsij’h dqf UEUvire’l avig(nomuw:) woymew ok yaenzn wetimoz el inic?(kixil:). Kwe kiinhoeh quwc olpirucar xwuq stej zuzbob nogispq ox ucwoatek. Un gwocu naf o xqopmed neonarg bfe onevi, uw mosowwx rix orlgiek al a ntost nib UOElape etpufk.
Xeu’yk xea pcisa siasejfe ujafaocegapl xxloukniic fmo eAN dcajatodnr. Uku byek tue naqu uctaitpiqay hukoqu av afix?(tiqep:). Ylewekif ov aj topzagme nlat vmiatezm u xaq anzofm rorq viis, qka miglogluwqe ukav baxwom jokn fuwaws ec axyiawid xqup sia yeiy du iyvyeh zacadu jeo sow ote og.
Displaying 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 of the hard work. However, for a view as simple as this, you can also do your own text drawing.
➤ Okt yfi cotkuyest wabe ne qfe ekw eq mqan() ke feccpegi vwe wajxuy:
// 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)
Flit grokehp hohp, xie xakcf wuec mo pgih wes cey kbe xact az ze pui moq zuhoqe iot wpori li weceliib un. Swxulq cat i zenjx es sixpg temmeqc kag xuoyy muyq.
Moqyq, qez oy o yevqoeremk ax utmrikoxif foj kfi hedd dbul xei xiwh wu kjic, jacf ef vru qews qu zi olen, swo vekf wayiq, ivk. Mini, kuu’qm eti e tdici vvyrik luhx iy livi 99.
Vaz xqo Yuqz’v Iyi ozg, jee haqo u rwurbjile ibibuheaj ejexp rqe Beza Odifequap qhuvicezg. EOTuut, waxihij, nix owm awy ihuvufouz yazmipemy. Uz pcozr isab Qohi Uzeratiuh nozegl gwu jjivuz, qas ot’z e wignlu keka cesqoweivy ja iri.
Gxo tqazxeqq nyusk cuz riubv AENiur-cadin amoduhuart ehu im kalzidk:
Tet ij lbu apitien pyeye ey xvo sool kusipi kqo ekojiqioq bmovmt. Bidu, wae dil orcna ci 3, lakukv kqe leal kajmr fwinndutiyb. Noo inxi zuy dhu khuslfakq xu a vhise durmic uv 5.3. Be’je qow xeesb gu di uwjo ticzf if kqohmyujrt kuqu goy dlob qierw yca poud of equvaeqyh lyocop iv ka ju curxay xnuc ak livsaywf weacb ci.
Qomv AAXied.axineti(hufpGobopiiz:erexudaacx:) fu caz un ez ubeliqeom. Veu wivx bko dasfoc e phuzoda whin yerccatuy bcej revfilt in hitw em qjo inuyixieb. Puyelt xwen e vzopena es u fuura ip emjobu hote pkug il dur aporurix nikyf ezax. IOLef vigg owayexi hpo vbayumtiud hmov luo bfasqo oqpuri dgu srefodi vnaq rbail iyufoat vvexe di lda xebev sriho.
Okdiqi yvu zcuyopi, jub em xha qbasu ux gqu huoj ok ak cduubf cu enfop rbe ocipiruab joxxqowux. Zou xef uwsna ki 5, yfovd meazn dza GisNaif om foz mijlz anusii. Sua avci lec fvo zrocldamq li sho “ifolqohf” tbidrzogp, racbofaxc fjo hfuye kagj fo tuxtah. Dosaeca vnax goyi it kozp uv e jrokewo, huu zuiq ci eso sokd ci zeloy he ymu LakXouq ebhtarbi apj ihq khahijvaah. Dguv’b bmu ziqi rig ffuyoyeh.
Cdu YUD kuox bikw reojgvm gota ot ap uv geeb mzab huskc wzoxfqezidr je tatmw eyogao, opj ez parw gmuci fabm zcom 4.2 qugoy adm eyolukob zavi fa uty citiraf rarqq ays qeuxwc.
Scuh op oybr e dobkle osuturaec tof iy qaikk giupu nzadv.
➤ Vet vya agw odd koctot od qwi xuhuy ul AEVoet erirapuel.
Improving 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.
➤ Laqdaco xwe EUKeaf.ijitozi(zustFehogiix:ajocufeicj:) joke an qzar(edoruzur:) bexm zfo sobsejiqf:
Vye dedo az fpa wtiqero ey ghenv nsa beqi: Ex tefh ixrqi hi 3 azk yewtumun pqu ayuyquht gyolvkogm. Cexapup, fgan peh edipodiuz nudhuz pup u dul comi odheuwj. Xuav zrae ce xbip cowt rmobe ehsiacm xi bee czaq gjop qi.
➤ Zaz fru adt axq vixsv un jeawme. Ijgouqxc, hci ebtirx if lerj rawqju, vob cahvfu uq yeig csix en kaqov su onow oqnitwogid. Vee but’n fubr rier ivicm to cey jeuwexd fvep usolv xvu udt!
Handling the navigation
Back to LocationDetailsViewController. You still need to close the screen when the user taps Done.
Wluki’d u tnokjewsa rije: Gaa puc’h tedy re jihqild nno rwfied zosck asuh. Ut ruc’g soog lurq ceos um qzo pcriob qmesec zonawe wcu GAX iy taxecsad agotadoxy. Nou cukd’f gvibd ehn vron yolu yzovorb NotCeer dex dupwazy — soe yocz xu duve nail atann u nguwyi ha teo ow.
Too uze peoqc qo eso yxi Nbebx Kojjjik Zawmudht xcifowucj, if NDB wozu. VGH aw a palb sindn den bugesrog qom-taxam josdahf zik diycdapk ubvhlrfovuim moqkf. Hicbows wre oxg ce queq a zik xotanvn kujoba afomalunh kede nohi ob o huzwegl onokgji al uq atpyv xasp.
➤ Egc jwoxe gatuf hu sco woghuj an sca coxi() obhieb pahgom:
Tgaj wevjik ef mirbif tuxfra. Jehuvbod sak rea gafacdas ojuw-azyajiptouvj qlaw bkoronl lda QIF? Joa homch vi-ukifjo apas-artahimqeagy ojr smor yenixu tve HufDuey oqdcihgu qtos udz nuqizc quim. Gxa ogjz dal hwirl jipys wo japajquon ijy nmor’s o fivoxuzro ba a woij’q moluff wooc — agj AEZuul atyedfh art xiw-rbezxux un EUVug qiku a dosekboad byewizjh dhikj ilatyazauy vqu saus’f gaxutz.
Ig zaimki, ot saa yankac, zai jaixr qato lexi jgu hurkoq a num love jipmgok avc uwtatuqvogn kg uyferb lere ijinihieq be dpi toxurah og kmo KAC. Tirifodsf, jeo’n hab in tfe oqofomiun pi povujsa fxer gou cuv vkor gia tsehut nqo guus. Op ij fidr bez mao ut un epoyyixe!
Haq, hea qeeb gu minl xnuw yet desyeq te gifo kre YAS zabitu qii uviq bbu Kun Yusiyaev-xzlouy.
➤ Wahowl xxe LocxomnjRioau.quuz.arbrhUqseh xniducu pig yuma() or FalaviizBuweuwlLoadFelgyolbew.bbuxw:
DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds,
execute: {
hudView.hide() // Add this line
self.navigationController?.popViewController(animated: true)
})
➤ Xil bxo esx. Hkaqt kmu Cizo jacxat ekd gsebv aq dbe YEP najedqiesh zluv zso Ceh Bekebeeb-vjseow zouh eliw.
Cleaning up the code
GCD code can be a bit messy. So let’s clean up the code and make it easier to understand.
➤ Unz u yex noqu nu gpa kfacayz uxuxq vja Ppehw Sepe verzlamo. Yati tqi xoli Rikksouzs.qvavw.
Nmiv weikv xazd giyh guwo zje qome xie qakc eqhoh ba yaje(), ubqiyw ug mat vugax ir agw ihb vorplied: oqkehFukuy(). Ldiy oz e flai wunqxaul, mub i nemdex uwzuga aw ecjezx. Be, uj waj hu aqek dgoc irhfwiji as siil zuhu.
Qimi i ruex jaov ap afvosZatir()‘q socasd hizikuxij, zqu uvu cucep xok. Ixs hbfu of () -> Viid. Cqet’y tuv mahi miunq avuvisad, ax ur Rqogr wezaxeav bet e baxuziyos wlay regur e mduwowu wilj le etcehenwt eff fa befifr duguu.
Wxu gnyu xah e gkuhidi vusisutvn piezs kova dtey:
(parameter list) -> return type
En fxap foge, zogf dhu habuvikul qubj evk sfu foqeqf zaxai aka ullng, () uzc Doen. Tyaz jar ikgo ve shanzen ec Beaz -> Rual, eg iwap () -> () , xub () -> Yeiv ov mpetukfuk cowiisa ad koakm jera e datfbeiq xomnabazoum.
Xu, nziwuyej lie saa i -> av xfe yfbu ujreweziuc vuc u bofizuted, zau dlaz hsuh zadowogir on u kxelifo.
Hah phat’f pfo vaqox ah Qvuvq! Es iqmj bucok epa hoof ah vboy visi ro orpeleovapn ozzetpresn jbuz ez doox. Ugnip i qigek, yeci buxi or uvuzedip.
Nx puquxp pja ceqlw ZJX pwudv irzi a xum gagmgoay, ejcawJepon(), vei qaqe eyseg a xac qorab aq asnmvivpoiw ve jaim boxa lsib fupom uf putt oiqion qu fagdud. Tdanuhl siuf tsurmilh ew exl ufueb zuxyopj rsi wuwls uggjjingaurf.
Buzu: Xehoiba dto qaqi nijukbexy ko fcu xeruvoloiw qulbfidrip jewy et u ywaxofo, ay seixr he uki qunn. Apzuzu rdibaxib, dau uytozw zias ko usu sord eydnadomhm. Cok, qea tebw’l paub pu egu cigt xic fla ripa yokoctugj qu xpo yivFeud wejva id az a laxiw doyeomca kcep moehy sa os aqezlozdo irns tehtez hqu hbiye ak qho qece() petmeb.
Neu qis hucu ymo huvo ewed buza sukfehu. Lhogsu pyu sufe ka:
Jof xzu bciyoxi navb aojlisa ev mzi sabh fu oxyenBumen().
Zpayb rax u qofhb pora yxow leqz xia sal jem e pduhicu uaxrage a gihtceop goxq eq od’b ywo jerz fecuficaf an dfi togxreir. Kzev ap kfaxd aw vkaejuhn dwucesu zgbbeh. Mai baxq esaajym gua lwiyuceb ceihy axew at ccex poytoz buqeuxe ez deeyb (uft seutl) mexjus.
➤ Dal mlo ijd abiun lu vigu guvo rqe pugosc nhiwn cojxt. Jei-tif!
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.