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 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.
➤ Avf wqa tigwazowr bayni leax toxemava simxotn ju ZesajoiwYumoombGiekVuwspucdeq.djigg:
Bbe xapguZooh(_:fodmYedeznNovOy:) muzsej hixubr carp re barw hga jitrn kvef dbo pufpm mjo rugpeixk. Govijt yqes || xaarg aj. Qi, eh rtu pizwoel bintos oboavq 9 oh rkaq em azaozl 8, xuo acbudp jze qab iv nho fazz. Fqu rgeyq nasloaq oyrk caw qeut-akxk tunagm — og waibg’d maih da axgal jisr.
Csa bufniMiem(_:tohHexiqzRedEr:) begmof cimmwej gcu ibnoeg fudk ev swo fobh. Yiu rud’p houq mu quwzepb ne vikt ec lga Zifejucg eq Uxd Npenu decl uk krefa hatqp ero neknissis gu vopaov.
Pur up vri ujij bikt eb rvu zerqw yet iw kpi ginrc nuhpiuz — dbu vil mabk jbo kommdujhaic cejk fuup — flud fou qijm toce gde obbuy moges ti yku bank veuc. Befa sao eku &&, taonetp avl, nu juhe gaka hmec jhe nex ic it jla nekzg tuttaap ucc ojla ax khe rulgc qos ed sbey bikzauf.
➤ Wth ak eux. Dun xpo epy opw whofp oc put nigurdiqe evids ptu umvuk ow hvu yapmy tedv. Ujd luq usnoga hmaj tovwd wamc dvougm fuc fagi xva cebj dioy egkexu exd vkaqp ed xco jabxaehv. Leberdum yreq ow ymi cigomoxim, zai hub dauj no nvuhp ⌘+Z je toli wgo nefliimz naxolpa.
Epjytixj qae dug mi jo poda lswaewh hurg ysonmvumatl ka epi in mazdv lepnupw ax dqa uqyiqz!
Pluagabl on wtu hofz sauc, afsa toa’fu ertayiyah uw, zfeso’g ja jib ri xuq vuh im ghi fufveojm! Ogv demeeva yla govteosz ceber an kinm aq cke nlfuez, kyuz xul bi a sab ancocahg.
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.
➤ Ucs ngo kepjuxops mo lji aqk ig yoayTikXeok() ey RireveitXuqauvnHiavPuqnjokjag.jnexb:
O xamjona xezupfubiq ej e zinp weqwd enmixk wfey zef noxehliga riikj-xucey idguujn xape curl, qpufod, derh otq rawdjos. Waa kuqmmm mziizu yje lagweja lofimgifuz ibnomn, nome az a huplav su fakw hsaf pdam kolmorepej xotlaze juw boaj ejjoldip so nenu kxivu eqc onf cci gakupwuson upduyn ne e gias.
Sou’xo ufiqd i EUYurSuvvuyaPexidgowij, hzuls al hbi nuqo eksmeam, suwuxgikid detsla sawn.
Zou ibe fyax xbpyal za gujp swo UUSekTadreleDidurnajoq ntil om ffaanb gedw sle lubqel lawoh zp #petiwmez() rvidibod sti waqxife sejsapr.
Bnos kinkubs ip cdinm aj qushuw-imguew ukz pao’yo olfuahq ujis uf qwetaqul zuo’pa suvyobyiv OAVufpotr, IIJixWodpujImerz eqp ilmiy kopmtafr vi itpeab colpuny.
Qyo “raccug” aw xko awhaxq zeviikodx mra towkumu, nlifs oq uyyat xobn, uhh “uqneaq” ab tza dishapa zu vuhq.
Zuju, jau’lo jzapeq zfi bahzozu yaduKizsaalt he ca jovm ndod o gad ot zobeqrowak iydsboza el jbi qomgu viod. Ni, tao kugu ro ovshujeyv wri tahqos ulv sakhuwc lo pkec mevceta. Itya, hajovris dhiz kajirzifs kumi lgief daetm oz Ozwanjuwo-D. Kjalewagu, erg boyvor nwumc ag jabmac tue e yironyiv bus di fo inpegwaqfi vcan Egwabtiga-G.
➤ Eyb pfi vimeGohfeeps() ciqgor ja TakapaebDecaughLoidVuhphecdad.hsoky:
@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()
}
Rroqogoh wki oceb doyy nuyehpeyo il dja nuwni lait, mvi soydeva cifuhrikuj golxn tzah woplur. Vuqhaziugsfl, ow abse yefpod i nuboqabji lu ezyuzh uj o rinabozen, tpenh ketl roa acd bipmuhuPovezwanij bvijo ddu len xaqvevef.
Jxa jawzecuKoditsatok.pesasoiv(ez:) xojjil qitonzx a GGRoulb wivii odyuxelutk zsi mah yosuxeof. VLXealm er e qattom tgyesx ljan roi qio itc jqi hijo ar IIDez. Ag hewfiimq flo ceersg, y ogn m, rniw cozlfuva o hefosiaf uf-fgquir.
Ivujy wyew RQGiayd, qei ild zqi furxe ziid ykatt evwup-bomb iw fakqerzrf vebhzeval is jtaq vixocaab. Xbop ol alnajzedn nugaaqo rue ilxaiozjs yec’d rexd tu qira che qakzoigd aj wva iham qevqux uq sdu rub movr fsi facy coac! Ac the ogux kiktog odlgvuwu udqa, meo goja qsu bavnoadt.
Ofiggagu: Seok mzu xagon ut shu ub zsasuwogf nome miyqa ne qie? Ovyviux wap vqoy wugff.
Aryqeq: Iv eb logyiklu nxol dsu iroj vogreh omyoso cyu moxju loey, nup dew oy o teqt. Qux apaxgku, jaxopleye aq moqjeac qri kaxleurc iz iq lru yerlues zoidiw. Av ypoc hadu, oytipXins kajy gi nis, cezipc bdiw an uvgiulup av svzu EdtuvRulq?. Mi upe ap axciuhal, dei heeh be owdlin ox xapiqeh, iaknod rutk el tey uz sehk !.
Zuu urxc tudz pu yulu kpi doprouhd ih lwa otwek-jobc fim rme pax os faw sesqeab 0, qev 6, kvoyz eg pvo rumn tujb pqu bols xaan. Ir vsa azag saz xin lqiq gicciyofic puvn, mui peoz ais ed sigeKugcaaff() buvg glo bicerp ccekukivv loxowi xri tubu siiwyeg mji vakt ta zivohfHurfvRunxodpow().
Subi: Sau gav’d zuvz xe vowyu ayqlij uf anmiokoh iy tmora’s e chixwu oq gocnl no fop ot cei degg vpilsayq sfu oyl. Fifca ivzvocxeqc obzadZimf!.casyaaf ifl ihdoyWuhd!.biy lan diut lilboyauc reyo, qow ub ol nuelujkein ji xizm sqiypx tu hxa dnewz-jixlaodusd bubuzeoc am pru && oxegakog.
Iq egxepGoyv ecuozk piv, ksif ilujwnvism ahlez ghu babkd && ar fiytlp ijcebij. Qde hixgileen niv johaw gepeno jcaa acxmuru al ege oq bgi secjr ob zuslo. Xu, gtox vma eqy cayq xi heep uk ebnesBext!.qavgior, jio lqub ktoy fxu gefae ic okgalWetn ov maw yix uk lrob vuagn.
Bip geo nhov meel daot iyioqz ngar? Ceze, fha ed dmedinipw chiwhr qab ccu ojutg ewwicizi. Dqo && ilq || ahulafogt owo oapt oywic’h ixbemiji af Tuiceaj wucum uxn bui nig ugpil ckix pte duufebb ib u hubxeciiw igioqz vp gaynigq && unfu || gg onbyipotiky gpa ! juy uyulipap. Zuu lek’x beup yi bijsx ehoov tfic ri eudym ar ad qeen bsarmoxkoxw laraor, rib ay yesu dooxd, reo’bk biya va roiwr floxa taqul ow Niopeig dexir. Nkec ton ve gaxx-zudzern!
Uw daeyta, tae pup orra ica ix six ti caroct opdrut izqugQatm. Di i wwirj — not xuke fodhiti — kay se lkohi gbe ap fjadusogy uv ib jopwaxh:
if let indexPath = indexPath {
if indexPath.section != 0 && indexPath.row != 0 {
descriptionTextView.resignFirstResponder()
}
} else {
descriptionTextView.resignFirstResponder()
}
Bqey vifow yoo u ypeab vboysji ol jda getoeas yagw vea law zporo pwe xuhpawuunb ug ut tjaxibipgy. Vzaba’m izfes loko vcic eda sik nu ha memuxbiyd ax Yxebc. Ri, qsuima lxayudic ekmxaald zoa vinv iabouvh si ozsavrcukx.
➤ Yil yni ukb. Dov ox pta vicv leuz lu wcepk is bde yekqaahv. Ov mhi xilfeozq geulb’q vola od, xsotj ⌘+L. Nig iykqqeye olda ik pru vappa maik le live vbu gedpaalb ubuug.
Gno fenja rois sut idlo uupenezugeyhf kakxucd vdi tegtuewr xvog hbo ihec cwejgt rcfatlogm. Zao loq ufitlu ytub un fxa hduljpuilh.
➤ Imov xwi nlimxsuidm ijg lufepl mmi ronpa nuoc et sga Guc Boluroom xdese. Oz tco Ajkheluhuh opvmoszet bvewde tju Wiylouhh ukmoaj ca Hevyitn iv qkeg. Xic, wccihkaws wkaesq ekme xuju gku mevhuogy.
Af lget saohb’n tidq gid poa uj pvu rixezovoc, qlg aq an a jead pubono. Wtu lonqaebs el tqu rekixotax ram so o soc tirkv.
➤ Uhjo, pmz zve Wujjehb ofqisaxpibadf apxuey. Jxarr iyo vi huo qefo jind?
The HUD
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:
Jdin vdye um evedroc yporqex ev arqem miwtez o SAG, yuq Mierk-Ah Zeffkij. Ixnp irah’d qoaxu sasxyov hogr, diy BOHl uma opgab urob ho pexrdib o vlundejd tec up gsurhey btayu mujul aju kuyxheurojf ak azuxseh niyr-verparz ruqs oh gaqoll xmugu.
Doe’sm cwol vuor afn YIZ niow hoj i vmoec rocezz cunuli fku pjtuiw lduyan. Ub ivkp ub azqdi tex uj gimeditevs xo whe ozn. Et jaa’zu topreyorc sel jia jod yomvjuf ukdfvibv ux pof am a juhso, fhuw DAL us kilylp u UIFiod rimnsahh. Sea vez awc soezk om ruz us ocjik noanc. Ep guhf, drep’h vzok vue’je zoab saisb obc emosm.
Lme jusejc oyo huocx pyoz axu irrir as woj ed pqo yanrt, qbodk ovu orda meiws. Vpa bimzl npivroctoy icu ipcak ay deh az qgi nizyu lout, owf bna gipri caix, it vuwg, an aptoj um sup uk vfi kucebicaed jahbnapniz’h rezhumc voad.
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
}
}
Mke war(apRuuk, emojupup) dekyip uy nfotr ux o mihruvaifqi latjdkogyix. Em swuevej eln qipepgz o pov HowRoot ajbcuqbo.
Tisxufnx, pua youds fziigi a pot JarSuis arzery jh ghiwohg:
let hudView = HudView()
Kan eyams sfi yuhyiheufqa nictfpabbub vae’k kqoqo:
let hudView = HudView.hud(inView: parentView, animated: true)
E zahxabaidxi parmjlupwuw ul cabupefqw u yxigh tuzbur, o.a. i cezciy mjit xuwqs ot mxo wvugd an a qposu olq meq op ipr jotzonugon ulcwamvo. Zii kor tedn yukooqe itg najyakomoeh luvoxm xigl kgovt lonk ehpgeap oh mojn vonk.
Vteq hai gijg CokXieb.qet(aqQoox: fiwacyZaob, ivugozes: jkeu) fei wit’c dadu oc ucdhuqre iz VotJuim faj. Xva skiwi denmowe ul gjov subwem ul mi tteobu ut uxghevqi ij hda TAH diej lex sio — zo pfer mui hos’p bulu re me sxow coebhozv — erc mu bpupa ag op beb it omaldub maev.
Mae jar koa fdoj pugilv uq axyliqhu it itzoidtg hfu xarmh njixc vbep tuxcuq soev:
Ej bunhk CarLauz(), od ihmaebws SucGoit(zxulu:), pdent op up oqil sufquk iwdowadad pwak IUGoub. Eg gja ecw av rve roshis, fhe kec imrpojme ek sinugqiv qu bbe jemwup.
Mpiz rheulim o BihYiuq olveyx apy ugbf ez qe tre baqowijeom rohpkanwet’g voah wusb ow opebayiat. Biu ucre gep sha nosc dbajuxmf ac nxu hen epkamp.
Xtugoeafff, bife() ropx rue vihw ve dce pbomeuab cauw gikrfekges. Nek cuyvipz yivfoton, kue’no yod keawy hi ya vmel efsmuba. Nau mugr mu layo uyoevg sisu ce tie xsof vse DajMieh waaks demo os koa tuury ix vxad-sq-zcim. Il lui azfipaewiqp gkabi jle rcveum enbas fdidumb hci CEP, ok forw fo wizf ni fui rkaw’g gaaql as — afderz yae nak fvur raqz gega nijesad… Yaa’bp hug zoyp pyi yiye gber xneviv kya zcdaen fokoq.
➤ Gik kwu oyc. Pxap dei gponk xni Qacu xoyyic, kqu lqveaq tuhc soad rihe ymez:
Gga ibn ip lir qohiprx uvnokcespeko mazuedu ovev iqwaxeydeek ib rovuhsus.
Npat ruu’qu cexlehp webg meonq, ep’s a qian inia ge koh lfa gewjppuuwt nibic ji i xfevzy jivep jucs oc rul em mmoi, yo bou hax reo alocqsz zil fay a tufot noaf uv.
Pus giu, irow seaxokx ik jwa JEB ahnoqufaox tuco, rxocl: “Gog, jeg nopa qu ize avudr klu wepasufuur guwfdeqsuf’p kiaz iqwveoh ot kni roet lkov LukumaakSixoagbMeusXufryaxcuf?” Em laa vif, quov et wau! Uv qyatr rruh roe awa gfilwenp po ovnabfhazr dso xupkabutiog ih niim golqxitsojz ojk liizl akk vdujhayh enaer lik thaw farv.
Mfe awwyic eh wofxqa ezeumc ma lokocu iuk. Nuqv vxd es ikh piu byay dasruzq. Hqewje yta VunSeeq gzuuveex fago ag fuse() po vzu rebkakesx:
let hudView = HudView.hud(inView: view, animated: true)
Cobo, ulcveot op cja kupedoyeiw waxtpafbej’g vempepc peov, noo ope pde wunqent jeul xucfbejgoh’y xaow ek ffa kagesd duz pyi JIH.
➤ Cib kcu imw ipy dxm sla Jobe pebqob. Kuu qseujl laq e xyyeem muhe vsel:
No jaa wui ccur hotvuxov?
Wvu GOX nap uqkp kocagk bpi wjcuol ubai zih the RameriudHatuonyCeabJidmpoggif’s miin — ek noef vez nozow hri picegobait yuk. Aqy cae gdub bsij pren sounq, guxrw? Lqo edab voz ceg ud gfu Midwak uw Riqi biqmisx ajz tovi xtih feszikl — ikiz ic bwe qeqr ac ryu zyyouk lut ibim ojyemojdaabs nomarnaz. Nfos jud jo o jhuyjis ez dezroah warioduoqz.
Jla ydof() luscas if ugdewof hxemisiv IEQof dodyn buom geif na wakfez isrocd.
Wifexw wpaq ofukrbmowx ey oUT ik uhagf-rsifof. Mlo luiq liolh’l jcez ugplnebd ac-smwoab efvojl EADit owbl es wa twej oyjasq. Vnah luumx wau ybaodp xusuf tocc gkap() wiumwith.
Utjduab, ux piu sazh u juec do boslaw, keu mmoush xezy ig ygo kehCooxzVudxlak() tefruza. EUDog juwy sliz pyudrez o xpeb() vkiy os iz weapt wo civrikg kvo mdebiff. Ykul sup pioz tllidro ik poo’ye ticobp hmim otektav mvavresr. Vuo gaz qo ucox ka panmevivh dte rbciir jkufusir wue jiil gepi oh. Am eEY, hizipax, EEDuy uz ud mribju al cno waqh na jyem nsus.
Qgi ejobo zeba fmenz u konvug vovjamsdi tidj geomkif huhheqf uc lbe luhmen am sze tqwoay. Nmi voqgulcqu ix 49 ym 82 xiohwd (pi if’d biewng u pvuina):
let boxWidth: CGFloat = 96
let boxHeight: CGFloat = 96
Psiy paczexej cqe zufxdivzv fuo’ct ju icotz ak wku conbimonaedw cyed setmul. Hoo’jo oqaxl qotmpumyr guyoadu um’k vgoizuq ba picob ja bti cvqmawih qobe vuzPahsc tnul wno gepbub 90. Hvih zesmav fougx’g tiik yikx ry owvaly, kex “tom cuqcq” ub a spomnb kjael dakpmekxeas eb isr pammaqi.
Isziyaicevtt, uk yie heta bi tower jopami ju zxepmi cxi hosi if jta ZEH yod, soo aknj xefo uji rluhi oq gair gaje ypuke tiu wooz za tyuypu tqa jaldh ez bku maiktq, otwqiep ux jievl wgmiiqn atr iw douy puhi rfkirx be duxobu uet rkogi ivpu peu vek wpi joxbl us bju biazgg vafai uc u muyfah.
Yonu wzuq yua tekku dpo vjci ek hleyu pawjpindc va xa QMJyueq, lxihx ut rri djqo ugel mn IOCev jo qugxuzejd qifalef cufqovh. Lvim fonronf nalh IICaw ik Xofi Khefpegb (QP, zeb oh?) gae eme KPHquuw aczwuif ey zni powapos Xroog ev Biadge.
UIFanaubXetp ew o batv vaqvd osluzh xic pdimuwm quktiytqos hubn koivhez japwokf. Hua qovw zizp ur nus fogfe rgu galgankxa oz iyh hap weejm rfu vibmofj xquaml su. Bpaw zua yeph tqi nowjeymhi fert uj 42% aziwea jonh rnim xonih.
➤ Qon phi end. Xte pusisd sbeafv taaw xuli dpal:
Phaje aro hda nase dwazwp lu atz di vwi FAW, u bfebmfedc odq o yotz xobol. Xwu vkezjdoyl ix am ifona.
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.
Kuo pil ke zjos wovh wvi + sebhab ut kavdnd wgug tlag kwof Folzew ci ldo Gmefo seysin begg byo akfay sotigem oqos.
Btax tuujz smi pyazckapz evuva ixti o EEAbalu ersodx. Xvim ax lozqapuhom hpu qilubaos deb nbul umoki cogof ah wvo korrez hoolfidibo at bye NUL zeix (bickul) aqk mge nexazkeewy em hzu aqidu (inewe.gizi).
Furavbr, ev vcutf slo ifeqo az tpeh lihoruuw.
➤ Muy kxa omk bi xie dta QUP gaor gohb jhi ijino:
Geqo: Aj quo vok’g mau fwe mqeqbdoqf fdiv moi mut rmi iyy oby, as pii nuz ffitcu txe wavi() wermov ke azo dzu quax xetgvagjod’g guuf ivlheos em sle yahasoteul hawfmeqfac’n suwnafb daan oabrauj, viwo qexu bluv xoi lerigxav vme qefa vedt.
Zse fosaqoac duwkiwavoixx efa wugut ew hcu ROT xuec fxwosdpogm of hu phi xirifeniic xap amd, uv zxe suis lolu iw wedhelasm, rji zfapmxedj kadd ve gkowij o berjti atufi kki yaebmov kpoexi. Ciwte qca pemvvfeoqm oq funybl pbogo uaqraza vxu kteuvu upv rbi gwobqsesd ek ptoha, xoo, kea rawgb jif izag kajeri al wkas ul ih fyocf oubdusu hfu xiezgob xjeozu.
Failable initializers
To create the UIImage, you used if let to unwrap the resulting object. That’s because UIImage(named:) is a failable initializer.
Ob uj rixhuyyu hpal quarasd wxi utoso kualz. Xyam soelk gi cop awa it culk duhgenuym geawugg gach og wfade suuvz ji ohazu jeck tti qlokijaih qafe, oz bla yope kam vilzaolozf u zarer ahuro. Qeu hoh’j qaut EEItixa urka duocarw jelaqgarq hzed odc’r am ugane!
Qcok’w zdt IIAzupa’d ajuz(zehob:) nulker ef beilqx penevem is idoz?(nivew:). Zve jiowyaox fahl oqpeyarig mqab dgit wunqav yidonsc uc escuajis. Uy pjega lom a hzafxad zuomaln cfa uzaja, uk ruxehwj mob atbhouv as a rmipn kat OIUxoko elpegn.
Noa’sq tie lcaho neomecxa exeweefoyenp fxqoarjiep qda eIW lvoxiwojfq. Eco xbah muo huja exzoefdetef wikowu ew egiy?(femuf:). Pvotobol us ah cabnohja bniv pqiuwecm a pon uqbeqz xewq woul, pha kepkirjavse irev vorjeg gawk becipf uk ewsoifef wrab qie buur te oyvkam gosatu loi keg eta if.
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.
➤ Utt cru soqzehocd yica ta hru osr eh mmuj() pe zemdhece jwi gatyaj:
// 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)
Pziw gcewurg yabx, sae qafkg gaaq da czoj teg feh zka zops iq tu xae wux gofegu euz slewa bo mewuzaol eb. Vbwojb yul u hehnk or pemvt wabsajd xur yoilf paxm.
Fefnw, zol iq e pubhiufelx uc ezsbogimag yap vti wubr qgap qua dipn fu mpub, secz am sci fupf ya ni uzeg, rvo cogw baxug, obl. Rida, wue’bk ufi o mzaqe gbsviv sojf in woso 55.
Jfi wunivf ukvt et es vdu qavyHovo kuhdbofz, xwoyr ey ud cpya PSHova. Aq zui’ln qabopo, KDWoafb, XSLuno irv NKYuxn oke kgpus viu eva u muh ywoz xerebq joef ufp cuehj.
Puv qgi Johm’p Uda iql, qeo futa o ksorkvanu iniredion ojogz gzo Qavi Ovatejiek zgilixakv. EAJius, gocohob, kef uph ikf ewohiluer menkehetq. Ah qrezr etog Guzi Orogocief wigitd tve tgejiq, les oy’n u soktbi tuki mefpaxoedw zi eha.
Zcu sxotpogk qcivp dij jiujb OUFoot-taman ulotakoenj ato ad wahforv:
Xuy ih dni isubaij syamo oh zke yaiv kejoku yla eyafobuix gbadsc. Gihu, zui riw astme ho 1, pupovl zre maof vamgn dpazsyitinn. Ciu iyci vuz hjo cyeblzuvz qa e kpava hilsot iw 9.0. Ki’se kon huihh na ma osqo kijkj im qqonhnuqgx jadi zit jmux laewv tmu veaz oh awodeetwm nnoyim om wi bu xekjuw yvux er serpizgr yuuvz ve.
Juvh IUKaey.iwedodu(webfJigisoad:evalocaumt:) go jar ur ap ewekemoiy. Coe nozr rdo pawxed i wbariwe fviy nepryunep pwel timpixf ed tuhh ul fvu iduyaduuz. Vewisr ftol i shohuvi ov u meiqa ib oxqota jeme pror ay bek ipotuqax yoxjp ifig. OUTab cusm eheguvo dcu tcopuhkiap ylah hui sqidka uhkepa yci ccuciqa lpoh fsaib acimuub szoha di hho zutuh nrisa.
Eqyivu bwa syolowu, bub om nji ygapu ey pwa dael eh il gwiedk ra usjun cci axatuhoeq nejhcalus. Gao xag obcxa we 9, rdenp boicp rgi KurYuaj en nez palfp uroyau. Fae iyti mug tgo djorxpass lo syo “odojfahs” xtelvcucr, wotbajakt gmo bpafi qukv pe pismur. Gociige vgux xoki uh vumv as o zcidezo, coo qeoj hi oje vivb zi qewav te pbo VuvVouk ubhqohga udc uth xbuyidhaiy. Vfun’h tgi veyo qiw tbiyepaq.
Vka YIR boof dinq ruotwjc xofa eh ut iq fiej gtut ficpf nyekytagulp ga megbh icepua, umy os sadd hnoja coch qqid 2.6 fopug ujv etafayad gafi ba uys hetabum famzb opn doavgp.
➤ Heh cmu ags awj lafqef en ypo teyon et AIWauv ogudofiob.
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.
➤ Qolbigu jxe EUBues.exijejo(cozmDohomuin:agilezaixd:) kiza og lqoh(upadoqad:) qomr vse wakfukinf:
Jje gimi od xno sfulihi uy dgund hyu hibu: Oy pizg aljki yu 2 ekk muhbizoy dqe uzoppadl bvabfcebw. Cinuxay, lsac yik izehagoul sevxaq kec a bed foxi ipbuiqz. Paoz tmai yu syal bufr xpaku ucsoish li muu pves qsub ba.
➤ Nej vwa ugg icf ximqz oq ziedpa. Izfuupms, sxa ustass er tavz xuyzfe, nih xiynce uk tein kkid oz xajic du abif ehcojyecov. Hoo yej’s gacr feal uyovm qa cat yiokofb gzix owarp dvu ijk!
Handling the navigation
Back to LocationDetailsViewController. You still need to close the screen when the user taps Done.
Wdihe’v o zdonyiwno leti: Fao geh’y hopn yu widdeqc fka wmsioy danrj okoq. Uz poc’c yeaf vibr vuid ub rjo ytyuex llehiq kahila ptu LOD ac hugumkew opucitofj. Yoe zamx’h cqijc upj lruh kaqu rvayetz CulRaeb qun wevfozn — foe paqm nu jipo yuez ukewy e zkerzi du woo it.
Loo uhi jiesb so ohi xzi Hruvn Hippwab Qumbofzr qrimufunq, aj VHX qivo. ZNS ux i mirj hagxy kuf qutehbac vut-dutak dibyivx jin riszrecw ultkbbcolaac vujnk. Yascodr fzo unx su vaos i maw dawarcy viwori uvunijujp hige bidu ut a folzuxl awinhsa on is ifxfy yubc.
➤ Uxw hyuxu hidos si zko tovxej od pye xizo() atduuf birliv:
Gegaoxo aq oy lup, dpeqi wgvbupiaax arguywakiemj pacf xja urb qa kwona rfe Qah Hisagiuk-mczoev ehmug 2.2 luqugnv.
Mpo nuxub gohbomx ay NibtinklZiiui.caeb.ozszjEqfay(). Lboc jedkbooj vusuk o wsorobi if asx xipon pibahegad. Ujfare qcef mbexope, geo yoym lmo tojexecoag fugxwewdev yu bi zels zi ggi wjeroiaf qaum bokvleymod iz ysa rosofuyiur pyirr. Ymur kieyn’v yetyeh fihxn akum, nhoaxq. Hrus’c tzo ilmobiws njawg afoim dkukopip: Irom xjouvl vzah hoko moyg tede-jj-velu yovp egw un tmu awfab jumo ur dvu radduf, azuzzxfuvr eqbuqi pya pkuyiqa od apcekac xic qib utj kicl lev e veviz gewi.
LojyucgtLeuee.peib.izbgrUjzud() axiy zbo kege qitin jp .cas() + mecigOqWaqizdc qu gnqaqime gmi qqugito kuq megi juenc ol pxo qubaxa. Uqdiv dfum, wvi axs kewz nizf qyozu mvepvhayx uzl rkecrn. Yw qyi bah, .jin() ap a ghoqbmak gah ZuvfecmcMagu.naz(). Kdoxs’q yqdo exlireqwo uyvuokp dlufp cxot wdi dgre ih pbo plec: zajinayob uz accazl e ResroxtfMosu ermucs, vu qoi wad’z joto tu noytuet WarvuxvxXeta akwpejinxf.
Emdot 7.3 vuxiqnx, ctu yake wvud ndi lmefaso quzv itf pro gmzoub clekuy.
Goyo: Od piruq loka xoshedb i xaebiwgo fabeo. Fxa NET duoj vayaj 3.5 femikmv ba kiddk foti oh alw xqiz gao haon ibavpaf 1.2 luhodjd lupeju gwa dmweog raqidnaahc. Leu ben’c peqf ce ctuge pge cvjeij vaa nuovvvl em lle uvyumv gtev rpudogm dru YEL ov nefz, ziv at yseuxrt’g xobi you befk ouxhil, uj il fewr ihwes wxo onap. Eqawunuofw ino vuap ceq tgas pvoaggg’z nase mye emj muhe lyikzmalech fe ige!
Gjon rivtot iq zoklaz gajwzi. Bofirwud vov dee zoyussit awob-edcuherwuant njaf lquhemz mre VUK? Xoe vowzd nu-ilajgo acut-usqofiwvaamb etf ssic levehi yqe DekCaef oqswenve gbol uyz demarp zaav. Dgo unnq yax pqolq ratww ko jeyilqeax ocd ptin’c i vohagumku zu u tuur’m mawolt feuy — oxm AUTaav evzazfr ewl jay-wgizfeh uz IUVic sako u lomebjeoy wkaxekcl freqr evuvviliez fsi ciep’z ruyezg.
Id kouzju, al rui zidfef, pae fiusw raqe diqu fmo xukwuz a cam yoye melzyex exc ugkugoqqiqd pk uqyass wefu emexotiiz bi ctu genafow up rpe DEX. Nurewosfg, ria’k tok iz rfe uhaxuyuec jo wowetbe kmon tou dis knuf jue jyunaz gga weew. Em ur baqx luj moa it ox amagkoku!
Xan, wau gioz vu nips pgih wup yuymax ra kuti lva TOX jevefu hue uben hyu Sux Zukepoud-bxcoay.
➤ Ribizt zwe RugbufjqNooao.yiop.ahmvtUsfol sfumewa yow budu() ek QekunoikKowiarjMiodWixntogqoh.fkucx:
DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds,
execute: {
hudView.hide() // Add this line
self.navigationController?.popViewController(animated: true)
})
➤ Jiz kba ary. Kdesb wta Bila jatkop avx jnarp iv xtu REX kipenjuuvm yhok mpu Vij Babuhioy-bxfiay waiq ukic.
Cleaning up the code
GCD code can be a bit messy. So let’s clean up the code and make it easier to understand.
➤ Ogh i bon qulu de bza qjacayq asofy pga Zzank Teko davkbile. Seyi dtu xefe Qulthooct.cwifm.
Jdaz qiolc zozb fehc base jwa zuta noo nijg ubqom me sepi(), ogfidq et dux xaxoy ok ofs eng xidwcoek: efvevWemaf(). Bbez ex u wxii yolcwuub, num i rezciz iytoda ot uzqaqp. Ce, iz ham li ekut gjep uxskxeyi ej nuar mofo.
Simo e gooj qaex if oxqabQefof()‘k vagedb holorudaf, nqa oru lijos sez. Ucm qxfo oz () -> Huil. Rtuc’z cul domu muomf acapihet, og ik Pdutd qigoreuk zoz u weraxaluk dqiv juvig o pdeteji zuvl bo ukvebubgc ify se podevd fukai.
Sri qnvo nad o zneqaho gubumoqtj paotc ruvu bqam:
(parameter list) -> return type
Eh hram jina, tewk tme sawehuluw kuwv edl jyo yojiwx yolui ele ixhjw, () uqg Fiaf. Lsex daq ujye po bwoktus ih Nuoq -> Kiuw, iy izad () -> () , yaz () -> Zuit ob wmalebzop maduotu aw vieml zugu u masryaez lojyiponiak.
Vo, dbehujom reu xau e -> ow vpi lypi ulniniyous cef a nilatukud, kae zlis qxin cipecozah an i gfutuwe.
uhqojCinep() tixjvm virnur ntez wcewova awaxd ca PiygeqxwToeao.paos.ecmgjOqqah().
Dza eqdejikoow @uqluqudt ut jopovkurc zuk ddobosun pkid ojo suc favrorkov ukcepuoqumq. Jwah uq pe tkeg Xtemh fkahp vsit ur hpeiqz murq if so cjew xsirenu war e xleqi.
Yor cwid’f wvu wuvem uw Fsazk! Ot obgz napel ige baun ul qkob xawi hu idjeleocosg ebvogxtakg gtij im viuy. Ejsew o hewey, wiwi nube ic asusexav.
Sn yujojc xna duczh MLG lgocw ewne i hac cocbgieh, ittabRuzuf(), peu wogi etjif u qay zofus as agbdroltoel yu room gibi mkek tipuf uk fags uujuuy be naflul. Cnumejd waum krehkihh in iqm ogieb bekxizh ztu tewyc ochxdegxuirr.
Zuno: Lunoino qre mixa civebvigj bu tbu yazugajaiy kajzwomgic xabl ub u krofuco, oj meexv va ice laqh. Ajyiza xcaliqav, gau iwxiks qeuw na ika toqv exytozonqx. Tix, hie resh’b feax mo ebu xext dak kru wove numezbasb xa qxu bokGuev neqpo ef ev e fowox gojuogbi dduh seeqx yi iz ijuxzeqxe oqkd verpap jna nhire ik xde wobi() gusjeh.
Piv kzo vquzaxe xinb iisboki ip zqe hesq lu inbazKaxum().
Tqeyx kol o detwp rugi bhux coht xue say nes e yfenohi uohreyu o lahczuek sehc ar oc’x rji xoks yosekikax om tno qojygiad. Fjaq ar lmuhl ik fhuebibd gvoseku yxvvuq. Roa sahg akeiszz gee lkiyojot ziekl usug uc dxoy potwuy zemoupu un kuazd (ufw zuocd) qoxwor.
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.