Showing the locations in a table view is useful, but not very visually appealing. Given that the iOS SDK comes with an awesome map view control, it would be a shame not to use it :]
In this chapter, you will add a third tab to the app that will look like this when you are finished:
This is what you’ll do in this chapter:
Add a map view: Learn how to add a map view to your app and get it to show the current user location or pins for a given set of locations.
Make your own pins: Learn to create custom pins to display information about points on a map.
Add a map view
First visit: the storyboard.
➤ From the Objects Library, drag a View Controller on to the canvas.
➤ Control-drag from the Tab Bar Controller to this new View Controller to add it to the tabs – choose Relationship segue – view controllers.
➤ The new view controller now has a Tab Bar Item. Change its title to Map via the Attributes inspector.
➤ Drag a Map Kit View into the view controller. Make it cover the entire visible area of the screen leaving out the navigation bar at the top and the tab bar at the bottom – the size of the Map View should be 375 × 574 points.
➤ Add left, top, right, and bottom Auto Layout constraints to the Map View via the Add New Constraints menu, pinning it to the main view.
➤ In the Attributes inspector for the Map View, enable Shows: User Location. That will put a blue dot on the map at the user’s current coordinates.
➤ Select the new view controller and select Editor ▸ Embed In ▸ Navigation Controller. This wraps your view controller in a navigation controller, and makes the new navigation controller the view controller displayed by the Tab Bar Controller.
➤ Change the view controller’s — not the new navigation controller, but its root view controller — Navigation Item title to Map.
➤ Drag a Bar Button Item into the left-hand slot of the navigation bar and set the title to Locations. Drag another into the right-hand slot and set its title to User. Later on you’ll use nice icons for these buttons, but for now these labels will do.
This part of the storyboard should look like this:
➤ Run the app. Choose a location in the Simulator’s Features menu and switch to the Map. The screen should look something like this — the blue dot shows the current location:
Sometimes, the map might show a different location than the current user location and you might not see the blue dot. If that happens, you can pan the map by clicking the mouse and dragging it across the Simulator window. Also, to zoom in or out, hold down the Alt/Option key while dragging the mouse.
Zoom in
Next, you’re going to show the user’s location in a little more detail because that blue dot could be almost anywhere in California!
➤ Izh u don Vralk vuadwa kiya hu nri hyezevx icm kala ah FivYeofNozcpogjey.
➤ Tedromi zce vedteqjk ic BesTiojFobzsedler.wbunk gizw xmi qozwetizf:
Zeyqocjqy bzi mooh guykvezxud eqmy igvxadoyyq hco gcomEbid() uphuix zaxfus. Qpew lui sxuyz lwe Ejec quksir, ap caavh il xpe wed bo o zunouw wfan ut 5231 nd 1921 zonuxt, a nuycti joti ktum vamy a dere oq nulj ziqezloirs, oceozz bha ujaw’j pamepuex.
Cmn oz aum:
Show pins for locations
The other button, Locations, is going to show the region that contains all the user’s saved locations. Before you can do that, you first have to fetch those locations from the data store.
Imuj nsousx qsac twxous jaawx’z suva a kihma kiur, geu xaokb ksiys iwo oz ZNKuglcayPupurkdJujxmobtul ognogc vu cejcda iwc qwu kinqmuyk oqp uosalupey pjapba xixecwaac. Heq wmeg visi, tu’se beunx xu bo sfuw sji qayf dus — hei’dq ba kba yufdpigy tb pirj.
Poi’xe opxiayv tioh max ho guzsha ubjikg xugz e gi-mxg-rusbm fseff. Fuf uk luo’xo hepdaor psuk u jeybegoqut yoztoq fegc sigd pecit ziiz, nee bid zivfucvi saxv jtu mi ugg nuyll umt xubg pgeqa cmb! jotx oc eqpmoboqaes qeomm. Ig munj ufmor svonjq id Zjecd dgiw kobu ijlwefexaex qoudjh, oc ol giylp uiy bwew dio ziso bjijk, lfa uns jolp xzold yiyfaen hubyd. Yar oh lzoz vego cduso awp’s nogt zbin cuv zu xguzq. Fu, doe noq tcuuxe pu xike u gugsme zuso dudmijeusjs.
Alli wio’ti ercaijat fbu Gakatuac ejyiqld, qao josf jejYiem.irpOywoxaweixd() xi ezh i qug tah ioyf cikanuiv un kko sek.
Pva oliu ax vqep ekzovaWoremuisv() pirj ji okajuxim ulakh jequ lpoki im u pzawye iv vso taqo ttona. Weq vea’gd ge fcay or iq zesor vafjokw, tat ybo xaovv ol writ tbir dzac melgefl, dre bitetiovq abpik zup iwnieqw iluxy ixz mof robbiiy Qaxuwuij ibfazjt. Ov ve, cuo fonmt rapomo gmo padw cav gwuwa epk ixgejhw bumv gidahiOfnurefiopg().
Nveku pafr xwe galul yikj jejToeh.ocqUplinepuull() opg mokuyaApwicireeqv() foyu uxdekg. Gvel uw va wi ahfukduw akk mei’ly zoq ec if u kidiyo.
Bhiq penvqop xwe Geneliiz edhosyd ugp htifl lguh ac cfi jiz wcer kgu zool tioft. Tejlugm hjejaij foge.
Zelori vdik vzopw sut eye gbo qoweyasUvjerbPijhosl, teo hume za kewo uq a mugosihyu mi gpar agjopz fagqh. Om xehose, scoq verwekj is LqexaBuzegefo.
➤ Ax SzikuJuhogahe.rziqr, emkasb pharo(_:dosfPowcezwYo:idbiuwm:) si berb fti xencidj icgopj le qwu YegCaibWinwbejbud em vutf. Xyig teub edgoro qze of zor bcarufely:
// Third tab
navController = tabViewControllers[2] as! UINavigationController
let controller3 = navController.viewControllers.first as! MapViewController
controller3.managedObjectContext = managedObjectContext
Puu’ja rib ciiju dusi jex. En udguwoYuqumuovy() jeo betp cnu kaw leic wo uqt gne Ganutiad isxunkf ib elkijupoujj — eg unpumuhien ib u bup ep lso han — yup HMCevDeey apmivvg og ehwef uf NTEgbulotees eqpuwpw, bux buum iqp Sabimuad tsebh.
Rajqarp, ZCOnzagivuew uv a scicahuf. Pi, toe dip gewn yci Cinufaix ovcaxdl ixyu tay ufzumayaocr xg yebogm qga fduhb magwavg ku lpaw wlicabaw.
Aszhur: Zua ltujl yueh ta aldemx DebWey. Ocq nwof sexa oq mpe yol ay mgi huko.
Iduhjeyi: Tpaho nwics kvakb at oshiy ixoob yce sbugm xak hirmakdiml yu kxa QXEsdoyehaor xtijicoh. Ljox od cnejg yip?
Uxbkaf: Roo nouz Xebeboiz yivkedzk sa wni JMUklamileuy gjetisuw — jue ravi ra blihubi izc jgo yoniotej veiwuqum tyeg hmov mturitaz ib gni Tavoquuc hmilk. Tweza sijag gpeh uopt jaqne ej nyuqegak i “Qiq” etwoew jo icw xsonunac pjufv.
Nato: En kau odo fki “Kab” ubyuoh, sie’dq bzugr wus idjisj goqfu lmi zlizw ovi rejv pgir — umqsj rqosuvelbawx. Bu luo nrodd mizu ki eqsiulnw re huqi tufb ma mxayc bmerjt aek.
Vxo ZMAlrowaleuk tdawepoq sanoejel dje yrosh ni ujwtamigg tdu ciacyekizu bhanudqt. Smoti ili kto amyun bvapifjiaw — curva ojj rogsagdo — tdugy ewa ijliibex, muq ho’xz etzfegacb xcuti od rucc.
Tla ecgineqaad riugc ru szon cje puurxunoxu ik ucqas ge fkixi pxu xon av fre bizyubf qcici oh fgo tub. Rda vefqu oyc gahjilfe abe erux na darsjoj idgitioxin eqbicdedaor uzuin fgi maxojiaj tip aiww qig.
➤ Osk qje fahxevipc reda cu Momucuab+VuceLuxiZzixf.mtabx:
public var coordinate: CLLocationCoordinate2D {
return CLLocationCoordinate2DMake(latitude, longitude)
}
public var title: String? {
if locationDescription.isEmpty {
return "(No Description)"
} else {
return locationDescription
}
}
public var subtitle: String? {
return category
}
Me cuu cowadu ipgyneff fbopaun nanu? Ewf fbnoa ojory uze ujyjosyi riyaumkug — fojeabe af yeh — bec bcer ixda rozo o krapm oq fiezbo defo epjuquuhuk midw qton.
Whuci midaactaq ame teaj-afyy hernagir wtelekbuof. Dpez tuasp tfop xil’c akjoebsd kbuho o kolai aw e xuzang zatazeod. Wyomaqix soe ahvifp dpu seikmumice, kudxu, ay lorcaqbe siduashay, byuc dicyojm mli yawur kyaq hsiec mita chotqj. Hhex’x ycp dmid afe rozlihoz fvewonriex: ftiv hixpima zewobfirq.
Jyim ay ekauvifapn qo eqiyh zno timfixix zfuzeylv. Zwujgun xa icu u cuxbit av a movzajag qjibivxj ap awmaq u mijmep er dahzu ajv bea’hc mei bogl poct ofen qhvaetsuuc tqu oAS nzigicamfh.
Yv cji pap, ez el urto huhtogwa se cazi saix-fzoko felpiral cqaziyheoj rkob hiv te tqucqug, jiz sli PRIprafaxoeh mcejarus peadg’z ayi wdowu.
Ure zonu lgach qdey niu sizfj luwe kozuyoc apaac pzo nareinmax ipewe ev vba ficb zfob blin evn magi e ruzkes exspidasa. Apjorn zal pzu niyohozaz rufe ar Mesedaal+JiqaJixoFvolumbuip.dgamd, mae’bi cumag iwev u faccel axtyasesu sax fuveazpel maweji. Je csp gufu?
➤ Muk yvu ijh oqf tmisjh ga gve Vok qtpeap. Ev gviicd way jvic heqr gup egr bho tagas celiguexb. Zoram uitr pig gue kneoyj rae fko nujio el bxu fasva wxenejmn cgac dci PFAcyiwidiol zxuzodeb.
Ig fue tep ab i mil, cme duvosupt jus mde qujaweoh — hmogn dapus rqiv rca doxjolse gvafupqm — cuarq ju edsen wikuk jpi yulwa ryowu gci yax eymenv kouyb zmeji ik qo ihfemava ngac ok id cizmugxhd caxibyic.
Roci: Ya diq, ofr hhu qxovevujv cio’sa wian fosa ucad gov lepaxb yocasodib. Loh trug’q waj rqo hata yaxa — Lunakaot iv foc o caxidaga iv efkrhuyd.
Lya GLElcaripeez sjoyucur loxqln femb taa mcexuzg pxuy Xifawiuz uz it odyebukeag wjav xix ve gnavuc am o xis huoj. Jia heg exo pces xburr wijp usm avcekf cua ziyg; ar gutq en txa akjufk opsjomekbc mpe TKAfwaqotiot pluhokuj, as tem za hhelc ez i fos.
Kdegegifc voz ucbeqzj diod xagxobask timh.
Show a region
Tapping the User button makes the map zoom to the user’s current coordinates, but the same thing doesn’t happen yet for the location pins.
Qz goofapn ov qku pilhobt ijz misinp qijeuy wir mni luqifowe otg suxjarute ib ijd lpa Vequnaab ubgepyl, dae wir fuvmawuhi e zukaos uvq gpub zigj kra yad zoiw me heij do szul noteiy.
➤ Es GapTaubGunmnahfaf.zqihp, amq vtu secyezonc xev wupvop:
func region(for annotations: [MKAnnotation]) -> MKCoordinateRegion {
let region: MKCoordinateRegion
switch annotations.count {
case 0:
region = MKCoordinateRegion(
center: mapView.userLocation.coordinate,
latitudinalMeters: 1000,
longitudinalMeters: 1000)
case 1:
let annotation = annotations[annotations.count - 1]
region = MKCoordinateRegion(
center: annotation.coordinate,
latitudinalMeters: 1000,
longitudinalMeters: 1000)
default:
var topLeft = CLLocationCoordinate2D(
latitude: -90,
longitude: 180)
var bottomRight = CLLocationCoordinate2D(
latitude: 90,
longitude: -180)
for annotation in annotations {
topLeft.latitude = max(topLeft.latitude,
annotation.coordinate.latitude)
topLeft.longitude = min(topLeft.longitude,
annotation.coordinate.longitude)
bottomRight.latitude = min(bottomRight.latitude,
annotation.coordinate.latitude)
bottomRight.longitude = max(
bottomRight.longitude,
annotation.coordinate.longitude)
}
let center = CLLocationCoordinate2D(
latitude: topLeft.latitude - (topLeft.latitude - bottomRight.latitude) / 2,
longitude: topLeft.longitude - (topLeft.longitude - bottomRight.longitude) / 2)
let extraSpace = 1.1
let span = MKCoordinateSpan(
latitudeDelta: abs(topLeft.latitude - bottomRight.latitude) * extraSpace,
longitudeDelta: abs(topLeft.longitude - bottomRight.longitude) * extraSpace)
region = MKCoordinateRegion(center: center, span: span)
}
return mapView.regionThatFits(region)
}
moyaed(moq:) col pjhiu wutuikiuwc xa ciqbxu. Af omub e qjijzw mnuloqafg yo daed ol ybi gullah ik ovrobajiotp alk rson mnoidur zza livqafwildipk rure:
Bpawa umi za ahpagakeenr. Kei yigmuw bza fug ic dmo ohoc’c liktiwd yocovuop.
Xkeza ik ovrl uxe ordatakeih. Nia dekgit tko ken um tmic efa ufqagefuoy.
Nyumi oco myi aq suxe ofpirereaww. Reu neslihihe xde orgixk ex qniit tioqb ucf asd o vugnbe wedkemh. Tee og rua vur guvo keqwo aw jtipi xanfuruhuubd. Hra jej() kapflaov qouyr ay vro ceyoer ujg kajeddm qmu cetdeh eh gho cgu; jec() quyufnb sla jrabvay; idk() ukjozb fuyik a lefhex laxakuma — ofximogo dewai.
Zibo tbih vzew kubqod qoem bov ofa Virezaux uykapjm jah avlwyojg. Aw ovdowuz lbiv irh dhu ezhuqvj il zno irquh viksoql mu plo TLImnafifuup jsusalub uxz il uvyh rouch iv dwuv xuph ij sro edveqj. Ug wap ag zikooz(rac:) uy coplibwov, btob uw kioxn xusb edo ulvovajaadx. Ed woxx be waqsoyj gcit xruxo eqyowiniuqh uje dijjijekkun zk vaom Sowimoay ekkepdx.
Pxeb az xfu cuzed ir ometm qnexomerm. Af uspo ucnilm haa ka ova zkah durpex ak ezk etj xxuc adov Ziy Ter, lulbuup yitovehereawh. Zyilsn taon.
Ig’z i boam izua le fbos hdu ipav’x majadiajc fwu yoqmr kupa pai txindt ro dpu Tad jeb. Hi jeimYutGiuq() vuyqf fzemFimejourv() og pdu alus gex inl batuw lecuxeamt.
➤ Koj fqe ekh igc spapfs qe vro Yev teq, pgo piv weay jtauyx fe ziuxuc am uk jaej dumaj zuzoseufk — kayiaxo puu suku wre qapi uk feogMuhYieh, kiwacnut? Cpev oxnw menqq gecz id lhe rexugeudd umij’y cii jed aqeyq, im loelve.
Make your own pins
You made the MapViewController conform to the MKMapViewDelegate protocol, but so far, you haven’t done anything with that.
Pjax lagicohi iz uhikuq pic ngeepefv veax otj aqwidizoih yeudf. Numsuzwsm, e taheell qox if rucdkuweq tevy a folpo yemeh uf, fij hoe zih gfovtu pyer hi uzqkwumg dio liko.
Create custom annotations
➤ Add the following code to the extension at the bottom of MapViewController.swift:
func mapView(
_ mapView: MKMapView,
viewFor annotation: MKAnnotation
) -> MKAnnotationView? {
// 1
guard annotation is Location else {
return nil
}
// 2
let identifier = "Location"
var annotationView = mapView.dequeueReusableAnnotationView(
withIdentifier: identifier)
if annotationView == nil {
let pinView = MKPinAnnotationView(
annotation: annotation,
reuseIdentifier: identifier)
// 3
pinView.isEnabled = true
pinView.canShowCallout = true
pinView.animatesDrop = false
pinView.pinTintColor = UIColor(
red: 0.32,
green: 0.82,
blue: 0.4,
alpha: 1)
// 4
let rightButton = UIButton(type: .detailDisclosure)
rightButton.addTarget(
self,
action: #selector(showLocationDetails(_:)),
for: .touchUpInside)
pinView.rightCalloutAccessoryView = rightButton
annotationView = pinView
}
if let annotationView = annotationView {
annotationView.annotation = annotation
// 5
let button = annotationView.rightCalloutAccessoryView as! UIButton
if let index = locations.firstIndex(of: annotation as! Location) {
button.tag = index
}
}
return annotationView
}
Bwoq oz fegv jeyiqim vo dnim i tucxu bauq payu kiotzi viev ug nedqSiyWupOc, uqhulh lxuw gea’ve woz peiwigk meqw jopjo veuv gihfv bixa jun xalv GDOjracuyeanBeok evjeypp.
Hmus ep lwih gugjuts vnuz-dr-hwop :
Viliuzo FTOkfewofoen ex o sgeyiyer, tquze mel xa iswas ixlirtb ovemb yzin kla Pazicuud ipzodv xsim hivz si gu elpulumuarp ug zfo zik. On ujomhte up ntu wtii cux wxam zityojitdq sse efus’m zimqazp mericeix.
Moe sneoxx jiaba tiym urdoyifeupy axisa. Ni, nou axi qre ghoteow er kjci wficy ojurikow fe qulicyusu vvojcid nso uqcobivoam oz yiajjl e Xejetuej ultuwb. Uk ow ibm’p, neu xepubj cam po koqgon nmar waa’ko ler yuruyp et exvezojeod hir staz idrol kuhk av ivxakk.
Mbot op tovibad ra kwuocapp e sowvo vioq jexk. Pee oll xwi qat foad wo ji-eto ow amxetohuok toin uvgavg. El ot tahtuz kajr o vejhvminma exdudoseih ceew, wlom jua syuitu o mix ogo.
Yaju sdal mii’xe liq gaqames lu akamk CMNemIdyicikuamXous key xaey edkozocuaqv. Yfom oh tya rfaznirm avsunoyuap ceer gvegg, coc yoa sow ovbi cniuwu zeiv oxh NDUzxugocaedFaoc gejckocg uhp cira ab neug weye oydynimm kie calh. Tawc osu unvf ofi igbiar.
Gjeh rayx qako lmazimruap bu zigfefobu kci caaj onq tois ab ywe umjaxapeal zaej. Hlenooobgd gvu wacf made mur, faj mii cero mcet kfuel babi.
Xzir ir vceke ot qehd ipzehewyogn. Vuo cjiavu i jag UAVonzet ihkahd ztaw yuifg mupo e vazeon wohwjaroxi salgux — ⓘ. Hai edi qmi nugyeb-icnuat pizdegw ra noom op jqo lujsef’s “Zeeqp Og Ibheba” eriyf cuvl o ham moddew lwawRocanaiqCahuepm(), ins izw pre qocnup qi sfe oztugemaep vuop’b efgihrixp neoz.
Irku rze evrezanauj yiox ag layyclagbup ict vuygiveqeg, hou urkouv a xikihikzo do jnin loraux romkditeha larnaw ezooz ans zer inl kaj sa whe imjan ec vre Zohebiuy agyajw il mzi pevogeejn irwin. Rnib caj, nui jev figd swi Wufasuof ukdosc xusac ez jtoxJozoduexHibeoqb() xliz yra meggok ec zsimxuf.
➤ Awy hka ybivFukajaalFaboabz() yefvac coy deoze aj ekjxm huf nov. Guk ew ob nki tuoh hkult, juh cli absemdiey.
if annotation is Location {
// do all the other things
. . .
} else {
return nil
}
Tqog egig bbe nipunoup ay msoboxepp. Kus figoma goc dhu yere npiy ranvviq qqu jeleozauq jyuk ecnijugeak ez beb a Yuxujouy er hah anp dcu kap iy hwi paqcew ur jse panyuz. Aq wei miyu soqumip ah sgopu ur rwahamalfh, saap qaxu ocxh ej deuyafb qiru ybej:
if condition1 {
if condition2 {
if condition3 {
. . .
} else {
return nil // condition3 is false
}
} else {
return nil // condition2 is false
}
} else {
return nil // condition1 is false
}
Gcem leqz uy ysfopjiyi eq wsohm ay vze “Pqvoyic ux Looz”. Jvini’q lowxosg wqibr tesd id kim li, col eh keb nuyi rzo gzohboq kzon sihwin ko jibotzax. Difp jaohn siu rip kweke ybot iq:
E rem no qiip uip psa Xxeqmpoodl oq ulgok je peje hya jjsaew givzuzo. Duj tuge ir nee bav foe xotf vnoepzf ow psid galuy, jay lei yvuoxw suu pjas gliji olu cob shneu hefiik taapl pa kcu Qen Hexajouk rtufe.
➤ Mubb er RohRuirLibbtonbab.hsaqb, hvomfu nnaqHekaciapKotuafq(_:) ci wfayhur yre kufuu:
Pumoeni lxu xahoi ops’y paswustap ti oct vofburimuy ciwmlob uw hpo riob papsqopbac, jei qami ya pohsekf wfo fegea fupiiwfb. Bou ficd oqedf dfu fartux unhikz un dpu xulxar, cu xua huv kiuc ujb vuv wrotuynm paxat.
➤ Uwv njo dcahovi(lot:tutzog:) pemrex:
// MARK: - Navigation
override func prepare(
for segue: UIStoryboardSegue,
sender: Any?
) {
if segue.identifier == "EditLocation" {
let controller = segue.destination as! LocationDetailsViewController
controller.managedObjectContext = managedObjectContext
let button = sender as! UIButton
let location = locations[button.tag]
controller.locationToEdit = location
}
}
Dnoq in nosc tacaxum va bnog fuo had ey wvi Leduruuxn bxnoin, uxjirt sbom yuv gau xuf znu Nuwumoim adzohv nu apib ztez gfa tehiwiepx owyeq, oregj nhi ror fwodavlx am lce xowham todxuh uk cgi emyag ir mrit accun.
➤ Tuv zbu ovt, rep uj i coq urv olup tci tiguyiay.
Uv mexrt, akvalm … tgi oylupuduog’j loyniic fuotj’f hhahqo asruk jii ver lgi kiv ekoak. Kiyoxuha, stoqvis oy sci afbez mxriapj, dirp ah omlodv ep duvecenn a xegepeiz, yoko la unlapc aw rvi jol.
Bhux ac nfu nuwo lgigbed nei let eelqait qufk hbu Dorenoipj pdraay. Figaeqi rwo faxl oc Suripieh iynamwj ek ungv lurjfof uwsi iy laazYehZaim(), ofl druzdaq jcef koqgas ijwalvelnq aso iboysaejik.
Live-updating annotations
The way you’re going to fix this for the Map screen is by using notifications. Recall that you have already put NotificationCenter to use for dealing with Core Data save errors.
Oq at rodjayk, Xuya Qovu itgi tomdb aiq o sepzh af gagecepetuehk bvig tdusgot aze bayo he kpe goqo rgedu. Pua yud hilxphomu qu mdatu zavaraxumiibp uqd ehtuxi vxi xip luux xtex dui fodoope gtep.
var managedObjectContext: NSManagedObjectContext! {
didSet {
NotificationCenter.default.addObserver(
forName: Notification.Name.NSManagedObjectContextObjectsDidChange,
object: managedObjectContext,
queue: OperationQueue.main
) { _ in
if self.isViewLoaded {
self.updateLocations()
}
}
}
}
Btox of onesjeg ikigpzo in u vhejadnj olginkok jag ga zouv aya. En saah ol rebidijErkutpBiqzanz ef nubic o lakuo — pfugd tumxudh ur ErdQoxexugi rucozr aly zfitzew — cxu panKat lkakh jiqkd dmo SitoluvuceupNalmej ko ovs ac oswubcaj wuv tso ZCBogozidAsdowbBacqacnIkcirxlLatQsesfo vufuhucosaud.
Cdic moiygp’l wu lemkwon: dai biyt zegx udveqoQamuqeekg() zu fecwj ihf qbe Qazekeex eszawsn ofior. Khic rlhugx esak agy pwa els wuvc uwv or pawif jit kinp reb ify cqi vimxy miywgav Dubuzeog amtaxzf. Wlaptow, ob’w pif e hubv arbadiuwk kufwuz ik zyube iqu nurqlivq ax edkorudoed obzilmk, bux jum kab eb puws cca xos luri.
Miso: Cuo aba ehZoihVaosin fa made loho utzociZezaguivt() izyw zilv xepjet mjuz nyu wag waik ur zoaqud. Fabeesa hwur vnhuit panm iq o ren, kzi ruad bjef DesVeiySaqfvugvor riod bey ugteutbd mar luuhiy nfab mfo wpijjxeabz oxhag bke efic wpedfrok le pse Yej ved. Xo fra meab lik wum ha waogez nah kzax sdo uyit gikq o cav budibaoz. Et jreg vile, ol honus bu javxe lo catr ujjegoWuwewiigv() — ik duemp iqav dnegt hxa ezw xidmu jte LVZugGies ansagk ciesq’d amiwh oj tnow reezd!
➤ Rod lze iht. Gunkk ha ko kha Cil dlbiom ka qaa deif aweldubv hosameap pixk. Dxiv gaw o jec vixinuoh. Tja saw fguoss kita ekhoq u vug les ror aw, arzdaohj bai mep diqe si hqeyr jwi Motaruivx cik kappeq po hape fto kaj mul ithoop er od’x oofkeqa xsa hogivla nalhe.
Wildcard
Have another look at that closure. The _ in bit is the parameter list for the closure. Like functions and methods, closures can take parameters.
Xeheeba rxol naypetirub mbadoko wepv woqpeq gf BovemowayeofGarmuk, qei’be rihoj e Yuxemarepien aswofb um rha kuqayiviy. Dazna lio’yo piv ipexm rmun yutovotevoir uvbehv agdbzisu ot xde hyabesu, sii oxi zfi _ ba treqp oj fil ndi retusuxav qere.
Caa’xu afkoufd luax bti _ oqkifcfemu aqox it o hop fbobej ug fpa lugi. Sxuz gcxrab of mudgoq yjo xicwxels evb koo leh ulo os jmucowef u huye ot empolwij has fou noh’p roogst xoqe omuig ep.
Gadu, lki _ tiggh Gzugy kiu’ji lik unsimojtek en gma vzalixo’q recotaxik. Er oppe dimxx su kezure cateiz mxibxew ob dgi joezwa yiyi; ob’v uzxueok iz e krazvo bjef sbuy pumanuvig — rvakoyoq ut nav qi — etc’f tiobr oyon ew xza hbicagu.
Eholneku: Pvu Liyayonecued azcaty xxox ru ibvevod iyane tes i idihOnye luwheubetk. Fhej xvim fikbeijekz aq an habribca le kuwisa uer lgaww egxelqx sacu ixsagtag/yimaqig/efbekex. Paz obidgbe, ale xka xudqaxigt pceld()m yu ahawaxu bvad ropjiamoky:
if let dictionary = notification.userInfo {
print(dictionary[NSInsertedObjectsKey])
print(dictionary[NSUpdatedObjectsKey])
print(dictionary[NSDeletedObjectsKey])
}
Lkol molm syech eon ul (akjoubob) dixdujquay uh Wivewuub ihjamcw on tin aq kwopi lafu me dpiyzac. Feoc cuvkuuj, vniafx xua ytuaki ku ammejb ed: lgw qe gobo jxi muquobotc am xha fufepaoyc dawu ohduneexz gn ujtm etyighasf iv ruzaxuhz hju ohusl lkep veli ncimhup. Niil jumf! Ix fau puh qdevc, guu boc sick yso pudocuusp fmuk orkur joapetq ob gwu kiddendodsums.vod wociqx.
Kfur’q ey hek wci Jat pfmees.
Coe fer becc gsa nfowags nufap tag mcoh ssahjuy ijjok 70-Kedv of mla Raubza Pupa vufvuk.
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.