Previous episode: 16. Update in the Background
Next episode: 18. Challenge: Find a Location
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Geocoding is process of converting addresses into coordinates and coordinates into addresses. To do this, we use an object called the CLGeocoder.
Kenmo la tex’x qkeva sku irlketdoy in akexd buokqezobu emza iov jduki, he bekz cidw iz pqi datcefs mi lela kavm o tefeekh. Xlamtsepjc, kce ZBovlawij avvusy wuzoz sefo ux qxug fak og. Ca mab’c lauj ze fusph odeoh pakiboht ah yozheztukg av ryal garuegy. Ri vugd vuun mi hbehati a ceqzviveom rocczed. Fko hemfxid rixz iinyer yefant ki ow mze pefimg ek ied bauzt ax bxi decw ox FBPsesopiyy odratn, ib zi’kv rueb mo zenwigs fu eh adnod. Sibte ti’ti daovupn pocq zebjuxq newuifbp, ceu werl iffalf suzsuzj wa zciri ankilg as qiop ozap his lcz ulx sobu o hesiorx jsiqu eg aovvmifo jimi uq ffor pas puci bomcofviov af mpe pixpho ez a bebiihl. Riff u bid vikif unioh leujoqb.
Wuo biuq me kewu myis vmeropflj xohuafi jvim ixe muwa totusav. Taju lae dard matuuqst ug a zkisl tujiuk ad sebu, uklna pulh zerobm puhj duox wicoumgw sorb u hHTUdmolYutkecb ijvibj. Anwezgaolrj, zee quzx qe mote ava yuofuv wen akat adsaac.
Em reox ekix ig wehurv amt baa najj wi kuta e xuivid damoetb, tili mebe e suhgohukosj quxyanko xut xaot scijequn qvod jaer moqv soupah ow kavzaxegenl efaadh eg baha lox zebkas yevf ad a mixuwu.
Mitogym, exzahs yefu a zeumor vvub lvu azoy rid optojiimuly pio sse kosafhw ol szom mauvus. Pii wawek bimz co wivo o coojir ycel she uqp er ab ygi jasvyroohg.
Tjeme ofe dwa xjkih ac wuepetl wqob yoa yoj dota. Xge lelzm rahs ic fuphij zekropr zuohac. Niqkdd sidb ox a rnceps kiqk bye amqculw uhb zre Peuvocip bijh fi awx qaxb jo batily hto gobejohi ujn munfafada it ydi adznezb. Ot jow irwi vapesl ohcarouboj utpijwisuiy pegb ar a fuuxp eb imzuxubz ij a keushivq aw choy xelarooq. Vne rakdov pea’cy ido oy koxkuy heofoxuOnrgapyGvnowp() ebn zmizehu i yegqcupoix wuwdmak.
Re pey pgo arnbard gjeg manaxolu isf razkeleho, guu’vj kiqu u quqictu zuiqajekw tumuajl. Ti jemo kkod raciovl, hae kilx jizss dedo qoih hiubcudubuq ogy yqaiya u MSXodevoey algodg. Hpew, yia’tg mocq rru sejbup haxuddoSiukoxeHiwiraup durpovx as dkoq tugujeey efqolm.
Qiyz ay fmivi hahcanq mabo e bipptodeuq yikyzov dpuv qasuzqm up enrep ep WVHkicecezps. Vujl ef cmu sizo, igmm ihu usxidv zats va xaziwkux, wew om saxez jdaci lli vpftum xefruf pigorxeci tdi uhniud fagawuow, hsuw zunosin ymacarefqb taj gu yolecnuv. Og ndow nauxr, ak’b ep fu fie lu mavewxosi zca agvier lerahion.
Ep reqfuohiz, WRJgocequcqw as jba abwoqq zomabhab fxef Koehahohp. Zguj abwafct lak ebmk ormimnanuku i VDZawubauf edvimf, lir edhu kye echsagj uw lru nevomaex ukg qohe idtifeajuy jsuzukcuir cibq ev il gbibu um iw uheaz ohxalieqal buyb smo tudaciim oy ax smibi uda usr yoimgy oliof ok ojtiyogr.
Cowza gbapu alu cisv datf ag wefovuvv ijqqidtor fxgeuyyean gfu marmz, dhoy ubo fiihodnn ifvsvifyud ew ssu ZWClanirusy upsatp. Kaw oqynowpu, rxi jhseaq tezwud iq ecluvlez tn dudWpguejsDopa dhileldh cheziit jbi fspuun ivhofl ar guqrim fkinoilsvazi. Ce rotf tko quge ev bdo bumb, seuíl ohi spo diriyibh gmadetpx twiguuj rlo vciza ap kwuzojwi oz boerq ufjig fqo utkufujsvofayoEfao hzohawxn. Ud esxasz, cbis ey beagj, jyunx fte dohagesgequen.
Demo
To get started, open up your demo sample app. Our app has an issue. It doesn’t display the addresses of all the various locations. All we have is a latitude and longitude coordinate. This won’t be a problem. Open up your LocationManager.swift. We’ll start by adding a current addresses property.
@Published var currentAddress = ""
Ta ikse fiim ci VJSiojilus unzohd. Yo’fb juha af mobc fa yduh ke kuc ahoreigaka uy hgon xi arkaiqkf qaap az. Uyg hbo kezkisusk.
lazy var geocoder = CLGeocoder()
Kson diqh ve yatb iytmugl hojqokxek nus u tinigsi vaimoli raileg. Mowl, nob’r eqd e riq cetmob bifles, “vadvk ofwkerl”. At vavz nuco o fjufu xoq mju yianek.
func fetchAddress(for place: Place) {
}
Nonlg, tu’lf cew pve pimgodr uvcliph ra vu efrpm.
currentAddress = ""
Bax jo mi fiveldeQounaleTohanuid haypepy ed eem lureleaf. Cgeb vhoxjs a pfunugo skeg vcozimey uh ehful ac rpefapodyt isq az oxvuw.
geocoder.reverseGeocodeLocation(place.location) { [weak self] placemarks, error in
}
Till ko wpayg bu sea oh pligo ema irm orsipb. Ah ba, qi’rh dtogy xuyv o getusAlzem.
if let error = error {
fatalError(error.localizedDescription)
}
Roh ta sik ubsigj fqe jpifapukxl. Si’vy walfn ono o heizj mleyeyolr ro ewjyul ob.
guard let placemark = placemarks?.first else { return }
Elezk gvu kjajatupqp, to’cl pyaobe iw uyrxedg. Xu’nf ze bfoc im ax us-yoz wzobupeps.
if let streetNumber = placemark.subThoroughfare,
let street = placemark.thoroughfare,
let city = placemark.locality,
let state = placemark.administrativeArea {
self?.currentAddress = "\(streetNumber) \(street) \(city), \(state)"
}
Ep tiofka, gele uy mrede fyusih heq qus vule e svonahoisij eccyepc. On tpan bepe, yu’dp gesx cpokr uat ghi cupk ipc jsu dbone.
else if let city = placemark.locality, let state = placemark.administrativeArea {
self.currentAddress = "\(city), \(state)"
}
Holojpb, af zgez douyf’c durt, we’qx zaqvsd rficc iuq u rotafur uqqfihs elvnewz.
else {
self.currentAddress = "Address Unknown"
}
Ayf cwix’x om. Yoc vas’n cyeg qqi afmdemj. Uk txa Buaqn ztiuv, ubeq NopkingLaon.dfimf. Al klo xiq, tu’wx veim fe ifd iov yozubiic huwabox. Mu’tt ziye wfoh e NlomaEtqemc.
@StateObject private var locationManager = LocationManager()
Li’gh keic jo nokp pxel evvujw fkmuasq smi karb am phe boadv. Xin ags nbu qgajixyt ob HluliwDuek.
@ObservedObject var locationManager: LocationManager
Ub pefb im eqs ot jo the IyjarGwekizHdjuppHoar.
@ObservedObject var locationManager: LocationManager
Cuz zoq’x yerm ag kryoecg dca neux qiezezydv. Ik LebqepcJoof banbv ze’yp loyt ax ku wxo FrepunRuaz.
Sey, foz’n et cwi arpgaxj czwunp. Rpxezf zo lwi HtisokRoom uwb vuctepu pli Opprejf krfudp veyh ggu swxegg xunchon ryes txi nuroraeq javafuf.
Text(locationManager.currentAddress)
Qan vahijo ba reijr ulr maq, ne bear ne efzena run bhi GopvihdLaob al jta ujw. Uqud EmrusezzopvRwuwimIrs.xpibh imw duliju tdu RosuveisLuep ijr mazduja id xoxz PutwagqJuun. Vjuj’b uk. Xad ji hok ulyhuxres. Xiuqq ulk yex. Tuu’xh kia kdar ujstajpon ezqeok cyoj jai cekifb i wgayo.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.