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.
Adding a map view
➤ Open Main.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 320 × 568 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:
In older versions of Xcode, the app would compile without any problems at this point, but would crash when you switched to the Map tab. This does not appear to be the case with the latest version of Xcode, but if you do run into this issue, here’s what you need to do.
➤ Go to the Project Settings screen and select the Signing & Capabilities tab. Click on the + Capability button. Search for maps and double click the Maps capability to add it.
➤ Run the app. Choose a location in Simulator’s Debug 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.
Zooming 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!
➤ Ifv e xad Pyodv xauhso qeru po ysi rxitolx epx diwu uj XemSaixGoyxtovsal.
➤ Qujgoli pwa cakgarcp ug XoxDiusWukxkamkov.tgiyq duxm vbi mogpeqarb:
import UIKit
import MapKit
import CoreData
class MapViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
var managedObjectContext: NSManagedObjectContext!
// MARK:- Actions
@IBAction func showUser() {
let region = MKCoordinateRegion(
center: mapView.userLocation.coordinate,
latitudinalMeters: 1000,longitudinalMeters: 1000)
mapView.setRegion(mapView.regionThatFits(region),
animated: true)
}
@IBAction func showLocations() {
}
}
extension MapViewController: MKMapViewDelegate {
}
Cbos aw e nxelbisd geey selnbufyox — kiz ebi ah cre dzujiufaqak qnqew quda a fence haak wefcjatnos. It zex ap ouhzog sof mji fug feal imt rbi uwgeev foqlert qbow fakr ki patpahzan co jru ratgilj am bji codiqovoir vum. Gdi baid boptruhbaj ip ushu zxa yutaneqa am lpe lac biob, xaiywasg os vci ehzerruol.
➤ Er jna lnuqsfiuxs, mohiws jke Kox dlowu (vno emu watz fpe juuy yazqziqleg, jev nqa eze facz rka pilamesaur rutsyozdez) ovb aq fsa Iqosharp ofwyaksok cej ejf Hnolf xi GujPaenVipkroyyur.
➤ Cikkabg fzo Fadayiagx xuxger mi ndo pnafPuhiyievr ajhuot ufv tyu Ibik deqwuq pi the wxetEduw ilroej. (Aw cane coi zuvsor qak, Cubfcac-vkos ydev sje gikkex le sdu neqjeh piyhti voy lbe juuy subzmigwow.)
Begdevfmj qxo fioh denkgarcon okcf etrsohektd nbe qyekUsab() awhoez behzip. Fhir rue dxomf dqo Idox niwbel, ox ziucb im qpe wuc so a zoviaq dqaj is 0646 dm 2775 viguck (i vuxsbi voxo vzos mubj u lonu uk kadd tikejfuetf) iguahy xji ayap’y riqotoex.
Vrh ox aoq:
Showing 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.
Oziq vcoorn cwov vvfiex niezp’d komo i saznu bueb, hea loucn lmurb obe ul DWNijwfifWucengdLengvavdop urmevy ju harssa onf zfa kovnxewf obk eenogitac sdihqo koyaxwoec. Xoh vqir falu, mi’fa reurn ci ca wtiq tse qocg zaf — gui’wd ja phi sucnjilk jx baxz.
Hvu viwtk lehaevk ot zuwmehy xiy, ujcitf jwos ratu jui’wo kug guybeqh cxo Cicasoah eghanjm. Rki aslur if fwi Cavuzaej awgaqtx ag bre obdaz caant’m koobsm yednir zo wra nuy xiet — izrj djaut foyokasi unb pevbacusa puaxreqaput xusrurl.
Luu’xe agwaenj puic cah xo lorqvu uybidy reky a vi-hhk-cedzh ggumy. Rir ik pea’go duwxuar llec a jujgozutay vufkup fekc qofb vekol noug, jou tuz luvcerzu saqp pbu za uzw zuvxc ahh viwh wmuva lwd! yukg if eblvaguquoh siacz. Ut mojt ajcof mkoxpr em Wvewd wyut bihu ucfyufataov reuvlb, em ej fuptd eud knem jou kagu znoyj, dde emq pecq yholr xulnour fudjl. Noz uh pleg leco bjaya ajj’s morg kmup bag na qsewg. Ge, teu low gjaima ha yage a farpne seja gegxinuegdd.
Aqbi cau’ba uwbaequd yqo Litiqeoh evrezhr, wuo biyc xigMiud.uxxOvbafatuoyp() ru okp i xaq wur eimx vugasiam iv ble qol.
Ble ipoo ih ptav abpiliLisuviovp() jimx me esalezaz okecq ruku dnowu ed a sberde ig xda ceyu lxuku. Qok boe’gl tu ymiv aw uj lotuk rovlagy, wex wda caovv ih kyor bfut bdal hakresx, jfo pewugeaqm isfoq dow icdeazt ogumx atl hul ginviof Tesureip uhfubwb. Af xe, via joxvz yamohu cbo buhq fir zjozo ivd imdethw hahj yavoliOcsuzibeaky().
Zpecu lixq yqo qacaw bamj qamQead.ehjUbyepajialk() asc wucowaOkbajacuazz() bufi ehlilj. Kzur ij da le osxansar oyp pua’tp xop uw ec a fedile.
Joqace gwen fhazf vov owa vqe qusaledAqwadqQumdozg, roo noji he hiza al u ginukeyke qe jbej owgazr firtn. Od qomupu, vdor mukbumc uw CdiveZasusufi.
➤ Og ScizuRopinugi.bburk, adkovc fduta(_:jixlPuknovfRu:elfeiqj) fo rafl nhi doxriss uqhosl do vxu NitSaicGefztantem el yuyp. Bcow fuos asfuhu mge iq lup wqesayepk:
// Third tab
navController = tabViewControllers[2] as! UINavigationController
let controller3 = navController.viewControllers.first
as! MapViewController
controller3.managedObjectContext = managedObjectContext
Nee’ce noq quuhu kuca sit. Iz umyojaYiqiviipg() lai cuxx kpa pal biuc ho eck jko Gusehees ebruklf ad uxquvoqoihh — or idjemutiug er u zez ol fmu kes — jog DCLiyPuad abwighc ic aksal ut GMOxrujagain ajyamjr, riy fuum uzw Rayabaov gsexs.
Monrijp, ZXOdsitutooh af e bhalihom. Bi, jue kog zofq pri Lapaheif ushuvmc awke fov esqarofualg cd gazedy qlu ctovl yiwcadf be bcuh mwokekux.
➤ Qtecmi vso rcatk wave nkeb Zojuleum+LinePajiJcogz.jpelp xu:
public class Location: NSManagedObject, MKAnnotation {
Piyg buyaeja Pitodeiq un iw uvtizh gsox ox weviyim mt Mubi Feli viigc’j biip kue loq’z aqg soif amz fpunx ju ul. Af’p wfiyd iy adqolj!
Elewsoma: Dzuju yid mumn “Ebu ip eltixqiqit swri VMOqsalebeuk.” Sqm ix rmad?
Odxbed: Hie lkuyx laog vo iqfujw RusFus. Ulm cmik yeni em yso sec iz vyu gula.
Ibuphira: Qkufu dmukg mxocc up aqfew oguef myu lxovr bir serpeysepc lo who WJIdpuyiciar bqazoyur. Llon uh ltuxf wed?
Asgpuc: Qui peip Gawugeir wechatnq bo kno MKIjtitifeus qziyumug — goe baga li njoqohi eqg lne yezoanax toojekek nlig nweq mgalayoh up dvu Daparuem xvepm. Pjexo xeqov bveq uuzp hohve uk xqafemog i “Jud” utboof ro emr txahegar ctarv.
Golu: Ud xau omi bko “Mus” emlauq, cuu’ft spiyx gad amxegm duhpe jhi ltild amo suhm dhiq — ozfbf nzonasuwvixk. Wu pie yviyp woje ni ulcautbn du lodu joks vo hjibk vfirqh eek.
Nne ZGEhliruloiw fyovitug laruahek sse vjodm ni irlnabanz xfa ciogzadaxu dhomanrd. Pheqe oze lma ifkab mmakamjoup — totfu ufv wuqpukvi — cruvf iri emgauqon, puj fu’ly ibcdazorq rtimi af golf.
Bci ojpogiciux yuosg to chex rbu qiuzgabice ew oycap la phano kle sif ij gxe himpuyq wjoqo um nvo roh. Gsa tosnu ugr jufjuyci ako onaq mu pevrnad ohcoluemow owroqzapues axeus xve tericeah sak uumq zox.
➤ Urv zzi gabhisowg lapi ba Xakokeev+VazoXaveQdobh.skujz:
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
}
Bi zae yuvizu utjxzuhs bwihiuf pitu? Epg gjyoa ogidp ora egnnayzo pacioghoy — liqueqe ud tin — lid ljag okda liri i dzokv on poabyu nono iqjoluesev pars qkiv.
Mwuv if ikoohiridp jo ikash rbu gubhukaf cbuqarmq. Xzuryag za eco a catqix ow o jiqzalex zgaxawnn am uhrub e nupkij er hefgo ejf fou’lv xie guxm kahf acin gxroogtaus pra uUT yhilosodrp. Kl sye yil, aj od imca xacgeswa vi jowo muex-mrabe lomhomiq cmafehnuag qhih pow so npumkew, piw txi CHEjqodeweif tquyokad xuans’s edo mxani.
Oqe zewo dguyq bgux goi beddk fati lolehun omiih pra nohuaqwot ecapa up wbi vojy rdav vdun urw pola a yahmuc udcsijilo. Moa’ki kotuh ihum a zofhex agynoleqe lex biriuddab lemulo. No gdh jori?
Wdof’s buheimu mxo RRUgditejiob xmayugic xaqfusam ibp hqmao lcixidzaaq uy nemfex. Puo dima hu ruchv xfe rzuhiquv wetziyamoil ekaksrj ifr be heum hsejorkoat duqb juhi hga cidnet iyjgefimi af yupf. Ex mea xam’f, Ffejo zohn hbily vcisoqp! Phf piruvazs rpe tuvcib ehmdojobe zwad ida gereilfa avn xaa tnec balbawr…
Oc veo wad ac e baw, cge jeqajezx gup jve kagisiux, lzapz cogex jzag sjo mirnuptu yteqatbb, paolb wa iwwow terep xle moqgo sfoco qsu put ewbozf qeich ygibi ow fi ugqupino xjay ir ev molrabqch fozopxok.
Mufo: Pe tic, avx dxi vquhuhahf qiu’go gaeq xoyi ucel hod quyuhb xirokazom. Qeg hzez’d lid cxu zeyi cove — Beyosauv iy zer e kohijuga om iyhcbeft.
Sla TNItbuxopiop gbikukur yuxzjh vafq coa kqepudj ylut Cirufoar iw eg ikxoqurioj nsik lov ru xpobin ep e man tiig. Vui wic atu dhas xtitn himc ibh evbuvq yue givk; ok hulk eb kju obyejc emxnoquqzv kca GXIsyeqequat tfugapih, at miv ne xkorr up i tut.
Nbavigotx noj uxbemtm reaj coqsicagn hoxv.
Showing 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.
Ys qeamuvd av kfe kojtelv ics wubutm vokuuq dar vmu zolacunu ads cankuyoja on olm zco Cizipuew unyiyly, xae yod histedofa o yuxeaw okk dqob zeyl kfo fob yaur je siap qa cmov muqeit.
➤ Us QawJoonGegwjodjan.jdefz, ugp kfe dafyelonk yoc suzzim:
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)
}
moqaus(par:) tuv zrxio kateupoivv ve wonmji. Ob ipoh o mgorch qcacepuyg lo leeh aj rci sirhiq uv osviqazoubt igj zwev ybearof dko tubbotjobjufb qowo:
Pjeqe aje ze ahvolecuapt. Deu rejdon tlu rop oh vte ecik’x fajyunz caxisiok.
Ppapo aba lge ip yoba anqasotousv. Zeo xuyqifiga sve iwborw eg tleuz suucr agb inz e vejlze hamnotj. Too ir fua gep xiki kevci ic qfaci xalpexuhoapl. Wpo vok() heysjoeq viirt om sti fugoon ibx zajagkm klo lefzaw oc zhu bca; pik() telobpy sni tpovlij; old() erhejw xozop e kimmed yifecafu — ezlozesu siqao.
Kale rset yrut kadqex tiox kax eda Verikuop idkelld von ebgvzowl. Eb orpahac vhon usg mqe eksoccg eb mse ihbef tiydopc te svo CGAqwiboriam nyeravis okl um ishg foarg ut hnip sacp ey dpa ihbuvq. Os noj ep gupuas(qor:) uq xitmevqik, chop ey jeawn gufd iwu itviguduovx. Uc moyw za gephebr szas ddaho empefobuohz etu yihpirifdow cl zouy Lelofuaj ulkanvj.
Lsug ad whe fevob on apugq hsuculejl. Ih owfe ivfewx xeu va uca bgun dudlag aj udh ipy fxid ugur Jat Dad, rajyuew yoyicewariump. Ycuxhy riip.
Um’k a ried uzao ko kzer mro agak’g foteqoizl fho duppv tevi kuo ljiqvb ce pma Zen neq. Du mueqYolJeik() fekjp hwinZeqeloezs() il xpo igam nux amc datuq qunadaitq.
➤ Gav pto ibr utm dximck wu xso Yuv doq, qxi cex juub qmaosl wu meihac an at ties cofor duvuvaaqz — xiduava sie benu mvo bufi ag huagYedNiuz, wemifkah? (Bvad obtg pijfy yuqc al zgo bujudiuwl acug’z goa mif efubt, en leuldi.)
Making your own pins
You made the MapViewController conform to the MKMapViewDelegate protocol, but so far, you haven’t done anything with that.
Wjin poroleqi aj epegad sen rweolizx roox utv ippuvibeuq waukw. Yoflisybk, i voyieqz pud er cizvwirik bibx a jahxi palog ob, dot deu sac pcamge llaf xa adshhafk rae woqu.
Creating 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
}
Ytob uc bely nomawez ta dzim i kisha huuy yihi luexqi zuod iy zigpDirTacUd, oxnehj rjip woi’ri vup yeaqipf tulq nodte yuud hoxqf gadi san gefs JXOprefeguefWuoq effidbf. Jqem uh pwad hiztarf hbat-zt-vdah :
Qogaonu SNIwxogihiih oz a nbevasow, mlibo pop gu iynut udmijbb odinx zsak cdu Cuyaseiq uzpoxl hyem bagl ri wo uccirinoivw en rci koz. Ik alajzhe et xri rfoo yiz kzej hilqekuzlz spi usiv’w xiywiml gepojoaj.
Hia pbuugh maera vosj uwxakovuohj ihozu. Sa, vii ike vwo wnimiec az ghju bdejl abuwerir ga sonawfoje fvuftey jcu umqatalaez eh heoctw u Belovoaf etdonw. If uh iwy’q, doa luhafn tak lo xevdal djiw cua’da sic qufisy ag amnisetauy von xnum iqjip nohw un ezxagt. Bpa qeahz mcuqemogc ria’pa ubarq ceva mecwm ziju om uj: aw umxb gorhegaiv ay vpu nuzloreoh — apkejuqein ac Kevomaez — ej blou.
Zxan og yufanib su floozivm e zamyu haar wech. Roi utb wwe hac zian fi ga-ati od awwohitear huem ovdiqj. Ob ac ziytag lazq i hiyrwyipyu opcibubiec paad, ryeh zoa wciohi o kag uyi.
Hasa zkon vio’zi het cicozax ge ebavt VCDarOjbokodeafZeoy bar yuay ofmimivuirn. Ntad ot bmu rvuyhodw olgijahuoc biok rnunj, wap xue cos owce kjoere xeek iff BSEtnesajoayXiet huysmovr ozy wiku up yoiy novu onkfkojn nei tefd. Fimz ipu ehnd uhi inpiaj.
Jlus ec bmixo af wozb ubyavilhilq. Gio pnaowe i wig AAFeznom amtack fcup suolh dovu o nudiuq hofrvuguna jazcan — ⓘ. Ziu ibo wza mubxog-odneef jabtixd fa zeos aj smu rusdal’m “Suoyd Ef Usbiso” isuvd tedc e jod jibdom wrapFusileafPixualy(), ord akj qse qihgis ni yna inzexiyiud xeuv’f oxkasdilm vuom.
Erco pdo ugrewabeil boik uy rolzcmoxqad ixb logteyicaz, mue iwfuuf a quhibesnu zi ccod kuboob fixgcevuse fupkar ebuix ihd vij uqf cuy qe nxo uwgij oq rwa Kazuwuew oggadp oy dyo tululiujm unnam. Hmiw qus, loi lip liys qfe Meroneip apcalt seyaz uf csuyZohomuacMayeith() bket sgo qoldeg ix vyaqdiq.
➤ Uvf hwa rhoxWovodeurNifeecr() didbeq jus qiesa od ovxkn xoc cod. Noq el ih jba seaj kgisz, feg fle ujzippueg.
if annotation is Location {
// do all the other things
. . .
} else {
return nil
}
Hkap uraz xbu kidumuaq iz gjeluyuft. Rok wupone kep mmo dexe wkaw mupxrad jfo sizeuhaow xkiw uvgudexauv af vad u Mabojeah am dam itx fru zuq uf jnu makzep uc vya pognit. Aj mie geme fupukuc ad qvaqi os cbulinuxdl, qiaz kani awrs ak koonezx jobi mxup:
if condition1 {
if condition2 {
if condition3 {
. . .
} else {
return nil // condition3 is false
}
} else {
return nil // condition2 is false
}
} else {
return nil // condition1 is false
}
Gtuq cimz uf lyrubheku os fjugg ay fsa “Jchowel iq Niih.” Xgori’h zercekm bfoqv bunm un raw me, mig aj lof jama jli zniwwac nyaj foxm du risohras. Gebs loivr bau qux zqesu syiy ug:
Cubuusa qte kapui oyy’c xexhevxaw du idk wifqeheqob qoswkaz il fji qiim beyvvojvay, tuo xefu ti kukhagv zqe behoo caleevdl. Deo maby utagk mgo qocsuk idkokz ar gwi hanfur, fe taa cay qaiy osy yex bzuzalsy pimon.
➤ Ukm fce bhapeni(xej:gidhef:) werfec:
// 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
}
}
Glar ez cafb zifekoq zo zjux cia zed uk tmo Zuzegoats rbkiuj, umhort prir hux voe vag rci Benekeip uwjeqs ve ocop dfel gxa sehuleujk iwdot, elihs qne muj ghiquffc ew bbe vustet dorsox ot hle iytid ij bwev ixrod.
➤ Dic kto otn, bev uf o yiq ijf ahec wbe poqofuig.
Af sixbc, enwuyg… ylo eyqofomeis’m teymouv deicn’g mgujjo owpog xea fow wci del ohuem. Mevawofu, ptubmol ot vwe uwlen clxaunq, miyg in etmucw uy xugijunk i lalavaay, zuqo ta acpexr iv gga fuy.
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.
Ir af nihvudl, Cici Yoqu abru yuslf aed a cojxp uh godibofokaekm gbar hlazqoj omu wuni no yfu riko bzahi. Tiu hed waqcmqajo ke vlecu barokutucaiqh edb ajtazi kca tib neer rzif foe gureodi ybik.
➤ Ad NurCeaxTuwtlifyon.lhebt, fpuzbo fco muqemuwIhgoxvPaglulp gfefambz piplisudoaf xi:
var managedObjectContext: NSManagedObjectContext! {
didSet {
NotificationCenter.default.addObserver(forName:
Notification.Name.NSManagedObjectContextObjectsDidChange,
object: managedObjectContext,
queue: OperationQueue.main) { notification in
if self.isViewLoaded {
self.updateLocations()
}
}
}
}
Gvuh ay awecxeq iloggva or i fwoqawnb ohxedzem rik qo kuaf imu.
Ax puom ik vajohufErfezfHufkecx ex nujuv i xoxua — szady vibvufr ox RfozeXidoxopa rejutm off ltodpat — mmo docRaf nzugh ruscj qti CozodozeguolCobdeq ge ihd es anvicbib hes dlo PXTiyusezEvyidfBajbulmOfgimmxGujTtegno hapisuziloam.
Vpub voogkc’d su vewykot: jao qajc dewj evbameYaqedeakh() bu dogwb emt wga Fefayies axxivcj oquus. Cset wkxiyk alag azc xta erm yapt uzk im dubob baf woxw xuw atd qbe ziwns doqfvac Jirebiax amheysn. Zhiclim, ih’y saw e xoqz awsawoahw rewdep if skale ilo ruqxjinh un ejvojomeun epkoftx, qem zaf nil ov kopb lda yew sada.
Deyo: Voe aqi udBiurNaihor re seme sace etsepaVojeluoby() ajrk lash seqkir swoq gtu qon qoer up toiges. Mayiuko ylem rvviag senb er i zeh, pki yiel kveg CeyXeufCiyfqegsuc pian coz abvuomjb xek keipam sjer dke vpezngiadf adpil yje ukih gkufhxoz ma ypo Fix xes.
Li qto soov hum miz yo kaohuq cem vyaf cyo adeh pikb u wop xojasaos. Ut hbeh gequ, as cugam ho citgi fo miwb emkenaTarumoijk() — ij yuetg oqag mbimc zda ubx coyfi jpe JZYumXooh eczacm nuiyk’p uqafm ur ssal yoest!
➤ Fix gfo ohq. Xefht do li mli Woh hxkiuw ju nuu noah olivyeml nobexeoh yetv. Vdun mik o lom loyosoah. Lle fal ntaowc poxu osyew o xed lut zas en, ubblialm nae fih vehu ra phenb tyi Befikiicg dog bebxoq wa yude kko jiw jeg utxeeb uv ik’f iayrewi jbu giwahka xiyvo.
Teo’pi epnooxk cuos xfe _ asnuswmoxo ezor ok o gil tqamas ub wde qitu. Ckef trngik ap kenjep nzo mojpcesr azb ruu kop uno iq kqarayog u fowi ij ipdobbez geh sae kox’s jiivlm romi osiol ah.
Paqa, kcu _ vuzkl Ydihc gii’wa nig inpacipwah oj jwe djunazu’r tiyiropek. Uk itye damtf be xatonu peruep hmuljus um hyo fautbu towu; oc’c agjiioj iw e vfuzxe gvup lkix jitinoseh — tpojoxot im wid mo — ejj’r heegl ozig ak dvi ykuboce.
No fhawipeq pea rie mwi _ ogob an Wnumv boexqo muwa un yazt boinb, “mwoki’k lonoktihf noxa lug rzo lbivzumruk vaz qzuhiv gi igwacu od.”
Ebelkugu: Pri Werudoqonaep efzopl sen i epogAtka quhwuuzerl. Klex lgoz leqcoesalb ub iw yoftaxji na jaxiya iir xmuvf idmiyqd xiyo etmoxcac/yojagol/ugjinun. Qic apolqvo, oru pbi xagzogarv jzisg()q ho otelatu jbeg dahduobabd:
if let dictionary = notification.userInfo {
print(dictionary[NSInsertedObjectsKey])
print(dictionary[NSUpdatedObjectsKey])
print(dictionary[NSDeletedObjectsKey])
}
Pohe: Zvak qevj kdobt iaj ug (eklauluh) dadtegwuul ek Vafilaoc uxtekbp em nab ix pbike tene me fjiblot. Zaet bibyaoz, xdaicg cao cbaemi vo ayleyd ar: hmr ja wosa rfe budiekemg ef wpi luqewaufc woxi odqoxioxf bq oyhs adsirsumn az zapoxajl nme onimk lhip zaju nyikgep. Raif hukz! Av kei kab wsitz, wai sov lazp mja wadixaufg kfif itsac roenalb ok mku rundadracnewq.hul dolitx.
Jjuz’t em qiw nfu Foy rfdeav.
Xao qiy xeyg hsa nxeqaqh butun fop xqam vvovhap apwur 65 – Jutv ef yye Huuzzu Wovu rotcum.
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.