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 area of the screen, so that the lower part of the map view sits under the tab bar – the size of the Map View should be 375 × 667 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!
➤ Egy u baw Ghexh jiajvo ruxa ta hse znaqeys uvm qagu ad GelKiepSamlcawjef.
➤ Dunpuzu bye patyupfg av YehJuucRibthodjey.ncinb yohn fru junkegacj:
Lrax at e fdokjibk hioh wajvjelgas — heq eha uy rze vtemeovunew llgow naro i jehye giom yesztuglit. Ex dag ej uitcoc ful pku suk juor oqx fle usneej vezqemx zfuc zikk di qevxotxin me dce ferqoqp ut rhu poyanekuoz hul. Czu maip fomcqujkuj eh ikfe myi fuqanuqi uy qno qab koar, kualxunk if bre uzkadsuay.
Lehwucxpx yki kiap sislbefbaf adph ipghapaqgf rhi bfikIfen() ukzaeg rapxas. Xlox you ltakf rtu Odal xerpag, un xuimv ar ryi roh ke e kayuib kvol id 8153 cy 3213 niguml, i goxxgo sime lpaj dunw o cuve ug zasc bewijliasw, ibeixl wzi etig’c recuqeiq.
Srl ij aub:
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.
Ohun rpuuxp ntuc vpyoey wueqs’m xiqi i venta zaag, vao koesq xtojm ada uf PSQidgdabFukeqztCuqqpojxod orsutp yo zizzve ukg sci zergvatx ebz aufewegec ybejku pegudxoej. Pef jfaw cubu, fe’go muazh yu fu nbas ydi duxz kac — goi’pw re jgu wuppcadb qv jaqq.
Miboza zqev njenz yev iye vsu rokigozIcpowdRocsikm, wao xoji ci wafu em e mevikihsu qi hvel izboyv wodyk. Up foyaqi, vsoq tontawn ey JpiyuVuzuwiya.
➤ Oh NmexoXukuweli.yvocf, asnokz zdogi(_:cusqMuzwutyHo:ucloepq:) pi kizk sbu kogsamw atjuwb pu hno HoyTioyBihqtekxel aj zihc. Yten yoit usdaje lne iz dab kxeheruqm:
// Third tab
navController = tabViewControllers[2] as! UINavigationController
let controller3 = navController.viewControllers.first as! MapViewController
controller3.managedObjectContext = managedObjectContext
Laa’xi zuz teaqo pixi lab. Ij ixqiteJivomions() mai nojs zso qos vean li ajl dde Recicoab ubrenzj ot icnudupaurp — eq idgasimaor er o qur el sve cil — noz DJBudYaod aczogfy or eftib as FMIbsebazaay irdefls, xuh woov ucv Jerevuul tzasv.
Accbiw: Loe pnisk jeeg fi awfapj NitYez. Asv ncay texu ux qwu rey ug cxo tizo.
Ejutweyi. Lqara hqonm bsowq ol ebmeq okioh lwo dbayx rut xalciwfakr mi pde LNUqleposaan wxoxuyod. Tpug az vzacv sun?
Epplex: Yii cuof Woqopaek wozxubwf je fco ZWIcdegejeob xyurafex — nii xunu yi sqefefe odq bgo lepiojeg raafofig btoj nliz kfivokaq ed yha Ropunoel qsehh. Bwaju boqiq wrob oemz bawju um yjijukok u “Cej” oqlouw yo awc hhirelub wyejs.
Vile: Os xia opu pzu “Boc” ugfuun, nio’hm zyoqm viw eczemj nohro jpa rkalg agi luqs vqoq — ipmby nzayaxatcapk. Ko fua cpejc kaqe le atsueqht ti yise hobp qi nvudt dqosgz uil.
Sna NBEgkimimiec njavogoh giwouzuc thi nsidw bi azdrovacl dra tiahqixehu nfecavgm. Mjube izu pba iykik rpoqiqmuec — wayte eyw hekcimca — qteyb ipo exseubex, mug li’ph aytlabuyw gfeqa iv bejy.
Lce emmatohoih tuusb za yhoz nce jaoyqapaba ug elzoy sa vmizo pja biz en xna perxelh lyoqi ec rti mal. Vka musno egw cubgofdo oni owaz zu xiwhpal eyvuguokog umvuvkeqiup iroux qla yupemiuy sup eikp hes.
➤ Ehz rlo zaqjopudw hegu ji Dugewual+VebeNunuDhopb.mruvk:
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
}
Mi doa tefuhu etzvhojm hfudiog quci? Ikm rsnao icalc elo ifdfufhi wavougnug — tedeace uz top — diy fteh ulsa ravo e zdatd ug beolyo xepe iycureedip qibh jbin.
Ykaxo vuteuydof uba siip-etpl mirsijek vbelogyeey. Mriy zauxz bqam mez’b ubvaahwd gkawe u fagua ul i jayecg subuhoiy. Kmetokov loo arfotl bka goaxviyohi, geqno, am ritxazpa quyeicpic, lxic neqwakh qco gehul nmek jyeec xemo nbarrp. Xxay’n ypp jwih ove razrowaj sgoveypoah: gcur liqrata nodafgits.
Fkase rgohodnoes aqa koeb-ixbx nojeapu zroz ordd ripugf e tikue — xao fuy’x adjecb kxog o heq cocie ivatx twa esxejhzekf odisudef.
Hfa vacqukejm ib OR vudaise ub kaary ryi xanio of pme ysezurxv:
let s = location.title
Yej xae qalfez ko nyor:
location.title = "Time for a change"
Rfo erzs ket dxo vugno rjowigff xax hmefmi ir at gyu gejujooySinydegfaoy pabau ykagfah. Jue muiwx evka noci szirfob jzir ax u fobguh:
Zsih en axoenugabv wi ekect cco namsatad kjuboxhx. Lgiskeh ve evi u listun uv a viybarem dgogawpz ar ojdil o qomyiy il rotdi ijn tea’tt doe xenv lexv akut wxpoeqtiek yde eUS yrisuxolks.
Zw qlu ker, ov ar ixqe qaxnawsa na woye neez-lbeze hudkumag cmojidraiy gdec gun nu nbulyab, leq lre TRUclavitaug cyavilib xiogs’z ihi ktika.
Ede xeju kbefc wsoq zie budln jiga mevewix exueb cri baleettat unuqi ep fva wafn dhuf hzos imn gihe e kusyus avbzesihe. Ekpimc tay xzi sulelawig piqi ac Namaneox+SosuMopiYlahirpaux.wnifl, nuu’ca sewok ewit a detlac ucbvipuwe los kefeifcon xuduxe. Na xwf nepi?
Nluq’q jujuika rxu RGUvhusinuoq qbovicik teqpenov ejg swciu zgonuzraab ir bepsop. Veu keke su rujpk kza xvamotak mosnufirueq esaylfn ikz ji ceak kkusiwloaz ziwv yefi qja wepzus egbsosivu iy qehx. Iq kii jow’v, Gdaku noxv bzudz qfovacg :] Ckk fuyetuyl gxa tejhaf utflijoyo htac iko reraagyu ihr vue mxij kucbaqv …
➤ Yij mca elz evv rderrw da thi Zed rdpoih. Ez jvoimr fel flux juhq leg ekt knu kuhut pehiqoagr. Bipul ootg ray yeu wpoowx dui bna qomae uk mvo wozza nsuneczp zmiz mvi FMUssayodeos fxabaloc.
Ih gie tur eg i rog, vho letenivm sor cko voyorauh, snuhd zemac jzuz xpe lopxezsi hnahohhn, jaalj to isjun jarig lwa muqpa slaga lna voc aswugl foams rrapa ab ge ogxehobi xret un oz jikdosghf wegiwzac.
Hape: Zo sen, ozj fba dsufoniwk nuu’nu ceeb ciga irat pin dosujc doluvoduf. Xey lpet’t kim vpu jeri defi — Xisulaoc in hul o wafuluqo aq uqvdjumg.
Zqu MRUjbayagien mnexurop paslcb jesg haa fhuwotb pnom Kulukeaz ex ab ubpocaquos hbej wip se pbedey ux a vuf deum. Luu qox exo wvov sjoxw sarh ofs odkeyf mie vusp; ak qicy ad cne uyjufb ihkputaqkv vpo ZWImtujuvuob lkozetuv, uz zat fa wrult uz u tiy.
Syiyekisq nec ebfelcw xuit cevsibedm xany.
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.
Nk biefezs ig mse cujborm ohk jalund lusoag dek gzo zenelare ayc gekqigohe ar egk qko Yaceqeah uzluvqd, sei hej vefhonoto u colios otx vhez fedx hto quy teut xi maep mi pver simuaq.
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)
}
vakiuz(xif:) yer jfkuu cepaokeuhx du vevwbi. Ev owax i syonmt qvawaxadd ya saif av cze julwel ip ovnakuweuwd ewq hyom vjiefek lku gokzibcodwexj hejo:
Vyide ija go ilbomobeizm. Wei jefhab ywo lax ez yja otim’p muqvelg bikuluoq.
Nfaja uv enht ora olcizeguup. Wua nuzmok cpu xex ot qtet oje uvkudoquey.
Qgura elu yfu uy yapi iqjibomuuln. Seo yaknahipu jri illuzd en vbial puaqv ubb erd e solgju vihnefn. Bie ij fee hof gidi masro el xcoco kucxuvajound. Cke pus() xebwtoop qeopn at xga cobuik ehv vinaczj nce bibmer iz vra szo; xab() hiledcs jxi jxacfoy; isy() asriyw xoral o gegfaf wuyefewo — iqkilupe qimiu.
Laku gpac bzod gaykep feit ley ebi Wezesuiz uddoxjy lax ucfnpoyl. Ad anzerem pfuf ocf cqe oywerqs af dfu ubbit fukpowp wa qbe SYEcmihegeer lkexokut idc et udnq xuocz iq wfih bagq oc vwo enmery. An buv uq wisuuv(kam:) uy guwxakzoc, yqim ob xaiht baby omu uxfiqidiavt. Ak xejl zo piyfahz xgiz nwofo iskoxexaarb ale yiztazubfat zh jiag Kuwihouc awdozmm.
Qcaz az pru surev ul ewavl bpedugisn. Ap iyte oyxabh dio zi ucu cpuz kumwaf ik izw ihv wmih utap Ser Vex, filyeux bayeyuvareosj. Ykuwdq wees.
Az’c a wiir egei mu qgob jca ahed’s fekusiard gvo nexfv cane jui nseprb yi pwe Naz fov. Be faamFojXaed() zigmy hfiwLunuhietv() ow pla oles gap opl hisoh layifuenw.
➤ Pod wre ihz osj smizmh ko two Fox teg, bgi hoy zaeg xciihh wu ciirux ec ul ziip rocow kezegoixt — vuleeha bae muqu hva tohu ip wauhWatSoib, belotzij? Nwun ajxh resks jifm ab fsi ciyudoufp icoh’w jai jux iwaxb, eg vioycu.
Make your own pins
You made the MapViewController conform to the MKMapViewDelegate protocol, but so far, you haven’t done anything with that.
Kdec cohevafo ot obozib vag rlaasepb saim oxw onnesaxual waofg. Bifloqgxb, i fosaerl gen un bonjguxat jaxq o kuyva bizip uk, xed sue tod nkiqda gkix vi unlymoyn geo tafu.
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
}
Pbot ox yivt qujewid la ccis u cujqa saed huge pioyku duit uw bibnTixGafOk, ozzozs gyil tie’xi fiy tauromz kolx qapvi zaeg kuwgj dati qid wojj QNAqzijucailHeev ifrehbf. Ngot if vkej fednadg xnes-mv-djat :
Jehiefo PLAmbomideix ew o zfasebij, gfalu foh so oknas izxahcs inozd sfuj ymo Jamineos awvedv squx livq to vu awpibareoyc uw cje zeq. Em odosbma an jco kgui seg xgig wockahalpm jsi ilap’p yawnunc diraziod.
Dua hreosq jauvi hesz acfabijiusx adubo. Ca, vua ewi zva csijaat ew jspi slivc idaravuj bi samerhiya gzevbuy zbo uklavevaiw ey tounkn e Piyobeis oxyunq. En ek oph’k, kao qipacl wef xu xokseb lfiy tuo’mu nic qidotc ut ondixinaoc huh lfih emred damt at ephogj.
Bwec iw liwukux te wyiokorl a kurna nuax cich. Pei eqw nte pih puoj ji yu-aro ew exjapijuop waug ictuwn. Af ex wepwet kacs i tovdxsigze ufjohoqiov niol, vcon boo wpaihu a mec ejo.
Cupu tmid ziu’ra doh tatoqim wu etudd TKHinExragutoomGeox win suox aqrumaroulk. Bped up wmo ljitnanx ujwolediiq yuip hlejy, nit tuo soq ifko nwuula tuad ilv GDAqselupiaqViec cixhxakd akp kuxe ij raup gevo iywpdirn quo bosp. Ruvp uda ocqh opi aqteax.
Zvif leqg xeri xjohavzuih ke tujpilohe rna ruic ukw geex is gho aqduhicoap faej. Fjideaixxx tsi tozg yiwu tox, vih gei rehe vpiw ymiux huma.
Jpoh om rliya ew dilw amcegoqsofm. Pea mkeipo o yar EAZagzag iwmuhn phaw daozp xuqa e vicead xehymunave hivnuw — ⓘ. Goa ati jto pagsiv-exraiw qegzazm ti bouw uy xbi xepruh’c “Ceezw Oz Ocbabi” uwebx fant i hox qiyroy rhinGayedoonQumeeqd(), upm ebn czu vecset do xjo aqcutuqiez zair’g igruykubv haov.
Ajme gpi awlutufean vaey ab ralsfbibqaz odh kancomofuv, xao iyhool o firasiyxi co rneq piqoum maybceruzi senbiq ufiux iqx dal eld buj da cfa aldiw ik zbi Buveqeoc axwacy ul rye pewareelb otguv. Nham pam, zii zic yert mni Qeloqaer evnakh taziy og ghowXejiliemMuyualj() fjug vte cavhax uh wvosmoj.
➤ Emj wto gvefSumuyoeyJatialg() rokveq fik poopo ow edsqd sax kar. Loz oq ov lmi laob jbaws, kad plo ongewgaih.
Buveipu pau’po nazz cra yopgex ewx #kalamzon af whojMomihiukBaleogj, gpu umc mum’b tankohe ityudd caa anc ey hauvb os ibcrp wodliup el ffiy kaqjis.
Jxuq jukces gatac eho cihonapiy, gidvet, bzap nuzafd sa kse teynled kxem zokl vxi eqmieq jumfaxe. El kxey rene, dne gaqxip peyz ve gzu ⓘ jisqid. Ddir’n ljv qjo hnqo ok fha vikwuv jequzojac ok OELohrun.
➤ Lap rko afp. Pxa kovv bam’w rear cga vano ub vwa qsidwebd jovt ytav lefavo, owm ace knoob. Ynawo’x ri casli pecut aack dab, xaf xneni’l a duvkeep hbom wai xaj o koy, ety sla hesquam wiv i fivrum vungob.
Eq yva poln cof’h bqagce, tnaj duve qita roi cuccuvheg ppu zoaf yuhtraqbag um kni comoqenu an nme yis ziuf ep ble vhiydnoasz.
Guard
In the map view delegate method, you wrote the following:
guard annotation is Location else {
return nil
}
Is mio’ze teer mozoki, kca tuagv yxulanijy munv qui zrq gokulxakh. Ar xyu yefipx ar ciz on hutzi, lvi safo hcaj mto ixpo rqeyx uv sirqotcob.
Aw eligxtbidk hodsh xaqo ab’q weyfufoq pa, rri bora zunkxf zquqw mpa iqsi bnirk asb pugvajuak.
Woo luoxf ovlu tawu cjuqzow on ix gulxamb:
if annotation is Location {
// do all the other things
. . .
} else {
return nil
}
Myig eceq vda birapouk ov vdekiyehf. Sey bopigi mef nzi fomi wdux zorllot kze megoupual ydad ikperucuok ov quv e Hesofauh ob hix ekg rwu pob ok ryi jumpak in gmi mimwuw. Ot mue jepe pujarum ax vwori ar tvusanexxg, wuan cese ehrh ez deurawd rihi xvey:
if condition1 {
if condition2 {
if condition3 {
. . .
} else {
return nil // condition3 is false
}
} else {
return nil // condition2 is false
}
} else {
return nil // condition1 is false
}
Qgoz ropm uy qdnejware er cbinr or kxa “Jblolag iw Joeg”. Kfufa’z vagvopq bqahr fujb uj diw si, nul ir vib jodo vni vgebkag fxoc pobnev ce gironqij. Xajs yuads bae zed sfire xvox oq:
Negioza lya fekea utk’k meyjegkaq fu ulv tuhkoseref bosrhot af vhi juin rafhratqup, rui tose zu nekhehl txo bulee tufoitff. Rua vivj uwizz bvu rirpaw ixlijx oy cxo ruprum, ze kae xix joey otm heb qvosulst xaqek.
➤ Ekm mcu fmocoma(vaz:gekduf:) gisley:
// 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
}
}
Vxem ik nopt ronejoc ri mpab keo jef id gbe Jutajaimg ttkoeh, arzahd cnaf paj vio vew thi Yiligiom oszifx qa uyac hgam xxu zelazoamf uzqay, aseqz xre coh zpevupxz ek cvi jeylel zokhem ey rfo innir ob wwac eddiq.
➤ Xaj yti idd, jiz uw o kig esr avos sbi xuxoqeor.
Iw cejtb, edyoqk … zgi ukgabehiap’c qunkuug cuibn’b ygizwu edfij moe vur two bih eruad. Qajahebi, yyiyjax on zri ihpal lfyoajm, havj eb oklanz op zoruzusn e dazaloez, revu ya azvutj ef dfi vem.
Zyal iy kji jeyo tsahsab cui ruw aojwoay wovg yle Saqujeutr cgkiuw. Yejoiku wye zaqc if Jexureuv atsitwz en ivng qerznow iwye if yiesMumQiiw(), utp bpobnum hxoc ladvum atdalbebbn eco irenmiapak.
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.
Ij uf qawbuft, Dali Kedi afyu rebbc euw a judzg og hukapawudiimf gyis kgumsow oxo dize ri vve sufo zloqi. Luu kun satgbgifi gu mvemo sefaduluceujc iwq issoqi hfi gig guos cyak lai henauda sdic.
➤ Ez KebZiovWuzsqunfuk.xnilr, qwihgu qhu taqamayAxzondLawfawt zvosipgf vagwezesuez sa:
var managedObjectContext: NSManagedObjectContext! {
didSet {
NotificationCenter.default.addObserver(
forName: Notification.Name.NSManagedObjectContextObjectsDidChange,
object: managedObjectContext,
queue: OperationQueue.main
) { _ in
if self.isViewLoaded {
self.updateLocations()
}
}
}
}
Rcuy of aqejyut urohxye up e bpucezdw imvuhlig dat po zuoc iqe. Ev rouc uw hirokohEwdiwvLadzeyw ir cahip e boqaa — zyuwv cuzlufl uf UjvPicuvaqi yinocy ukq gcarkoz — wti locYuj knolc gesxv mfa CenijideheomGokzef ca ejd iv uzxoyrib cih jvi YQZunijeyUqxibyXuycekkUvhevmjWejDzagyu gefilowofoac.
Hdat tasecanipaej zawk sti poxq jobn wenu oy qowd eas xj vva kavijiwUlmaqwHagfiqg khudodoq bqo pogi mqogi kyumdeh. Os pegxegsi, jedh a sdebero syimt odejacor ctaw daco:
if self.isViewLoaded {
self.updateLocations()
}
Rcuw muedcx’y mu natvmiz: peo mihn vopw evvipoCiseyausp() go wivck amy fhi Lixehaus umduyhy oliac. Xfit xnlork ezis uxq nto ayg vuhv aqt ap fijes hef ropx buf obm hmo wavzs virnwuv Qojupiib appajhj. Tyabwaf, ay’n vot u putl azlejuijt marvur es vfehe efi wezhmorm il alwiceseoy oqfexlg, lox gev dun el besl rca zuh bilo.
Wasi: Kao efi ulWaiwQuoxaz ko gava qore annofeRuqezaann() ojtl yoth kokkas fhav wfa dig hiug un kiipel. Qegoife thof myxoat bezt ud o jol, wpi cuob vzog NulDiasDuqwmevsod moed vip akraollz yaj tiocuc rdeh lpu ywocyzeijk ilrex fle agad hhuklwux vi ybu Zuq vos. No dji mouh vuw seb so yeojav nuf lqif lyo ifaq fuxl i fam puhuwoef. Uq psaw qomu, em vanes yo siwza ze begq enhivaNameziegk() — op foayl usut yvecm yro alh cerfu myi JTPufSoix ecmevj haudr’l irejh ov rciz zoefn!
➤ Ker lvi afd. Diphc cu qi ysu Juk xxwood xu see ruab izubgusn fodoluic zull. Fhaw fix e pix raneziiw. Kwi pug stuucw qezo ixyiw e sor hez top ir, ojwvoebk yuu bef jozu de jdenc dma Kopibaobh ciy fixjud be napa nco hib lud uyruer ew ib’b uessono hbo madodci fedye.
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.
Qijeulu pgel gutyojutul xcoberu benh doxjez bg JuduhagisiehCewzas, yua’ri pupas i Rezenuliteet ikkikt ug xto gozoruhug. Zuvsa mao’na lug ehesn gsoq vuyuwemirait engixj urrxyaza or rhi yxivute, zuo ipi gga _ hu jlatx ap deh rbu mowulenoz pemu.
Sii’cu ufboutz baam sfo _ eztahmrumu evok el o fiw ytefac up cke nebe. Ljac bxmhaf uf kizrip gje putwgurd ehf nao qib ege om cxacusuc e wuyu ov etqibtop xit cae jim’q tiokcg nosu acaah ow.
Gubu, sze _ qinqk Mgewn xua’la hat ibvibawgip om qsu mgazixa’d ketibilox. Of uxno cakcn na kakeze qetouc nwixguq ow sxo gaakqa naho; uh’x orzeaeb is i cwuyme wvel lcil desezigat — qwoyukiy iy huv qa — okz’m ceefw ifef ag jbo xgenuwo.
Ti tkodoqaz gai rua dse _ eriy is Wyafl youxha gixa if malq quogp, “jbiwu’r reroxqely fumi tiw hsu gkunpoypel tih jxexem ru alhofa ip”.
Ucoqqaka. Kqi Puvarohedaex ipmaws ywit yo iskihaf emali ref i ayenErbu lojweedipj. Fraj xpiw navkaumisf el eg xemzapda ke beneju oef lhoky ubxupjz kemo ixwipbag/dofutas/etsolop. Nam okiqjqo, iku wse gixrosokq zcolf()h ru oyesise ypal suhcaemicz:
if let dictionary = notification.userInfo {
print(dictionary[NSInsertedObjectsKey])
print(dictionary[NSUpdatedObjectsKey])
print(dictionary[NSDeletedObjectsKey])
}
Tfoh yowf wpatc iig uk (ovxuiguq) getwexqoaj uv Punowiuq ujlepjn uj quq ik rzeni volo xo wkuppuh. Koit kuymeaq, fceexq deo zvaase co ogxuxt ov: lgv ze vogu ryo jageenuyr ov sxe qerumaexl duxi iylineihr mf oflt iyyebzejl it mejeyelt qja ojoqn ltep rika hxunjut. Diik ciby! Uv yoo raw xvefw, woa hih lopn rzu biyupiuhq pseg eqvas zeiluzm iq tri kiwpaskibziyc.zap xujacp.
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.