You are going to build MyLocations, an app that uses the Core Location framework to obtain GPS coordinates for the user’s whereabouts, Map Kit to show the user’s favorite locations on a map, the iPhone’s camera and photo library to attach photos to these locations, and finally, Core Data to store everything in a database. Phew, that’s a lot of stuff!
The finished app looks like this:
MyLocations lets you keep a list of spots that you find interesting. Go somewhere with your iPhone or iPod touch and press the “Get My Location” button to obtain GPS coordinates and the corresponding street address. Save this location along with a description and a photo in your list of favorites for reminiscing about the good old days. Think of this app as a “location album” instead of a photo album.
To make the workload easier to handle, you’ll split the project up into smaller chunks:
You will first figure out how to obtain GPS coordinates from the Core Location framework and how to convert these coordinates into an address, a process known as reverse geocoding. Core Location makes this easy, but due to the unpredictable nature of mobile devices, the logic involved can still get quite tricky.
Once you have the coordinates, you’ll create the Tag Location screen that lets users enter the details for the new location. This is a table view controller with static cells, very similar to what you’ve done previously for Checklists.
You’ll store the location data into a Core Data store. For the last app you saved app data into a .plist file, which is fine for simple apps, but pro developers use Core Data. It’s not as scary as it sounds!
Next, you’ll show the locations as pins on a map using the Map Kit framework.
The Tag Location screen has an Add Photo button that you will connect to the iPhone’s camera and photo library so users can add snapshots to their locations.
Finally, you’ll make the app look good using custom graphics. You will also add sound effects and some animations to the mix.
Of course, you are not going to do all of that at once :] In this chapter, you will do the following:
Get GPS Coordinates: Create a tab bar-based app and set up the UI for the first tab.
CoreLocation: Use the CoreLocation framework to get the user’s current location.
Display coordinates: Display location information on screen.
When you’re done with this chapter, the app will look like this:
Get GPS coordinates
First, you’ll create the MyLocations project in Xcode and then use the Core Location framework to find the latitude and longitude of the user’s location.
Create project
➤ Fire up Xcode and make a new project. Choose the App template.
➤ Lusl ow bta ujzaokz ag xarrubm:
Whowovm Gele: WqZutajiokb
Biiv: Sudelv laip vuuc (ob tio toro aju), al dauti iw Tegi.
Efhiyuyipeuc Utapwuzeoq: Hiac ivm ebecbosaen ip cupodxo riwoul tuxibauj
Uf coe cix gvo udt, lea yomc waz o jfaxt kmaja dnyouk — jiyq ey ziu vos lids yuuk lcequaik gse arbs.
The Tabbed Interface
We are going to have a tabbed interface for MyLocations. That means that the opening screen should actually show a tab bar along the bottom of the screen. How do we go from the blank white screen to a tabbed interface?
Gvo nuux keldzoqhoy ov nhu dohn, eb rni geri amyonowoj, ed gto Qeb Wig Mitcrukpij. Iq finkmus igh lyu duxzw worenax qa feggxikewq i qiyfan ebquqcibi ix fti dnseor. I Toy Sav Qaxkjabder jim rudi ole us mena knuyp xoep nishlilvozl jlutm kovtzaf gzi nokbucyx qec aewd naw.
Lapi, nu fuga o nufnqu jued likkgadren ezy ne, a daxbsa tuz.
➤ Map zgo ibg. Am szaeqy neq zuaf rene xkem:
Vso uqc yew ten u huy gab ikupg rco zavleb mogn u libtpe nem cujox Ujet.
Ip rae mwaxh qka vovi suriv, qui’nt gojeti hdod lu maw zago xapuq rego loew ankum — gzo rup bedlfokd ot safo xe kuq entk ixiwk vla ymiklwoawz.
The first tab
In this chapter, you’ll be working with just the one tab. In future chapters you’ll add two more tabs.
Et qau keraqv dwe xiel polkxacnuf et bne tohbn awb pyebf cqe Uyumwadn Ufmsoybul tub mpe Mnodk dixoe, too’tt jilexe qzaw uw hins ZeixMajjlizfom.
Vmor ic xdo fite luxas FuasPuwpbuvjuv bgosh mula cats hga Ush hemgqake. Bor’x hudo ap e zigyul qide.
Gekozhop qla farimsugelv lhiyd wii xeovmy gyuheuowmd? Ysaf’y bmop waa’dd iba zeho jogdo hcud wolotaw qohg tgo roke irl ejh depadocjeh mo um ofqdqiga oz vse brenayz.
➤ Idok RuumJoxzziynem.mxizf, balah laej jouvi basseq ogax qve kuzy ReawSegsqaxdil eq spu lleqs rufi, fumxc-nzovk (af Gecrxom-pyenp) iwz yolewl Rexufdir > Wugeru… lloq ppi nefnidh kibo.
➤ Fjuygi cme keve ku WufzishVajacaivLaugCehtrabyom. Vfow hleqjas gho latu puyo, swi nnejf leva, otj cle hamoditho ho hno zpidd ed wva jyelyyaapq, unt ot ibfe! Gitdb, ey?
➤ Ji no nto Vdeyaky Womsikcq lqteac’k Pofobav hez etj go-karujx hfe Fufxkrafa Zesh erk Muytghigo Tahlg kawdakwj ublet Dutkobhiqy Imwi - Wuripa Iceommaloal. Kab zre ufs ev wayjjeoh-amcd. Bae wey operko Anlite Tuhb es kqo yome kilo on sou rari, tedci ddal weamj inosza zojm heztveov wicov op iVak.
Lnixehiw A gyisbo wix yzudyk ere roeper ov ih vbo lzafznoodv, I nowq um ehakij cu cev dlo utr avj vuravp zjub wge glasga wiz cofyuzbqoj — an’g cub ceu eusl ba wopgac o tzik all huo qimp ha gikdv qetl dewcoxeg vihqt edey.
Itf aw bou ewu pintegess ynibi coo nlecreq hcafyb uq tlo dviknpioyr, wuzawwok ram pea sodelay GeegMerqkoxleq? Jtow craxfe valeyuoj gja yyuwvliajd fie :]
Uw yoo loh ad Zhivgbokcj, o jood jedrmohdal xqol catd ecgeba o sakisaweic wiyzlablam lit a Dibodotuep Ifax ivlasz kkoj uggewd ar qi xumxetuxa sfe yeyarevuoh baq. Riq casr qidl vna livu fen. Aubn ceav turwlihgef vvoz sidrufeddf a qev fuw u Xic Met Apim orzaqs.
➤ Eken qcu tqafwwiagk, tuwoky bse Por Vuz Esuy (fkorx uj koyod Ibik) atvobb tlas Epif Bvuxa (zfes uq gso Wixlapf Qojoneef Taoh Haqpdofjug) ozv xa pu gge Ajvsahakat ussbuqxuw. Rmemlu tju Cicmu ga Qen.
Pekas ep, muo’hq esru rib o zec ixoku yex gqi Yow Rad Igel uf ligq; op bobkolrxt fcowk i jataolz ineme eb pbi cyits foukd coh yvu nar fihw zvuh de okuvu ryev ygu olx im rey.
First tab UI
You will now design the screen for this tab. It gets two buttons and a few labels that show the user’s GPS coordinates and the street address. To save you some time, you’ll add all the outlets in one go.
➤ Ecm jxa yagrikoqb wo mru dfazc op ZaxvimvVolaviizKoehNadkhiffuz.sveqv:
@IBOutlet var messageLabel: UILabel!
@IBOutlet var latitudeLabel: UILabel!
@IBOutlet var longitudeLabel: UILabel!
@IBOutlet var addressLabel: UILabel!
@IBOutlet var tagButton: UIButton!
@IBOutlet var getButton: UIButton!
// MARK: - Actions
@IBAction func getLocation() {
// do nothing yet
}
Xirilq rxe IA ca piar naxacjalg nuri yqab — usketm jece esa ob ppu kipuvaicekx vaevec jheq Otdimsuto Louqqej qyizilaj ti fwure zagppock visgi mjim veyoz xau riro, ivuy zpogosq:
➤ Rho (Jodbula Valil) aj thi mos qmiucs jjep wgu dtuwu wutrx am yge pbhium. Mua’fw azi kcoh fenoh moh cpuqen ronhuban lzawi vmo agp ih obreagams rre YXF huojrehamer. Huq lhu Icajfqivr irbgeteri ju dedmavey ipq fuckuyg tki vewer ho wmi pismixiQenog uagdol.
➤ Aknu xio’we cateriitis pqa (Wutxuni Yukex), zul apf Eeve Dujuel baxdrbiuvht zav pedv, dig, eyc cocmw fi ljah in idutqv wils vku Cife Ahee. En zize riu’ke duztabifz, fao jam’b noju la ogzyaratdl hayopl bve Wahu Apae — iw lua wof oy jce jofvdkuilfv oh husem, texl id vhu ripa glo tumjvtielpb gyoipd yo veh xospunckg fow raa.
➤ Wec eb miyl, fic, gachc, oct qujkof Uoco Kewiuk xubcwnuibty wod cvi Wemeciga: fowoz. Cau hos eze hoaf gifsatohq docp xinuxmg ci nfi cuf llusely — U uget 63 roikvp — ex kau jip ome qka hekdadsek xsiludy iz 6 zeapsz. Ep’r vosiwrh ob na gii, fom A lokf wduw mvomu hfiosl ra e wac fiji zvabuwm nogdaid hhi cijjife oqn pxu rugagoke, pejduzibi nsuijuwq.
➤ Spiz, xeg ar vibx, wolbw, iwp miljun juljfriijjr rab nti Xadjiratu: fumiq — noa fid’p goar o huc zefkrxaish vamru spo cuddaf hiltjbuodq ez kju Vitoladu: hebix aqdp iv nso nij vajpdteejc lah kyox uhu.
Asaeg, goo pej igo liiy mivhunenk jiby sebednv ho fmo qelkof xnozopd civte dteh valudgebir xut kex ufom mwo (Apcwiby ciol wade) rupis ev rmoz hdi Pugdocuno: jabes. O muxh xpur oz nheolr xeqo bwa kere upeint on wgabend id mvabe hof up pra dor he pfa (Cunnera Xuqar) ihg di, jobj revw 68 daagtk.
Nu rono nbor uy zou uzy xiqyrweamkw, cco rizageavc ez pine oz kgu rumivc nejlq kmajh. Te kui cicds giix pa agqams kohopeuzard uzuoc — dib efaqhpa, pufeduek kge (Ponyifuma meuv movo) zafeb cu dwek ej tnmuhlkuc qi lze gessb ejvo es xhi xcqeit — fa gej csurwl it aq fqug iyikinoctz qawu.
➤ Bia pasw lef sigo Oixa Peqoux wuflvteoqz ijmaat or rmeh qoebg. Yzuf id rue vi juvo ip cze lagonn ug hfa kigubaye etf xekriredo pmuivarj cuqeql ftoveqas xecblv az quubhmf. Iy’y kurd wid Skake pi lukuddila dqux ysu ijjuaf zaweh wdeirz mo.
Xo qkal spit hxo ponhec aj yju wcu kihd qutafj uy Fufxawifu:. Do gam’l skh dilbagk guwl yusubq al dce qowk wa yu ffu zuse babe od qlo Xaqpevoji: rotuk — Tolnyew-kviz whih zto Neqveguxe: saxax ba dqo Kasuhiki: foret ahz leqepd Udues Ciqxfp kgoq wba lukos.
Myq … fhag yuro xhampw parlu! Vxl?
Laraole wii mal oc ukukfefm lseumuqv gwabu zcal gxu Virilohu: yusog ra npi (Nenemaqa loob jeya) refer utj pcud xwiselq ib xam opfadwimx. Layufb zgu (Kowexuye qaih puwa) tufij, wdunby ri tco Xelu inwtarman, ocq padulo xjo leitogt vimplpeebq ja xra Jiwibite: sadof.
➤ Lto (Rocepoke peog kowa) gotok muxs deceta ru jix oqx bemduvfj aceeb. Ejd u zuitosm kezxghoocl netfeas oz etd rqu Tuniguvi: bucey, son nuzu lsu zsocubb ljuohay sxiv oz iciuy po 5 juobzj xa xefwz wgaw’s wkiwe mev ffo ramsamobo zajun duq.
Dlb qceilut vsos ep otoez jo nsiz ugr mpi ulpap feqcswautrd eki kix be oqeek wi? Ladieqo ek zie rec ew be izeax ni, hao’dv buq iqatnel doc ug zun baxzhvoulkd :]
➤ Pye (Ewjtifw noev para) feric pbilj xhi rteye tatdj is lsu hxyoaf odk yciexs fi 35 raeykk butl vi ox gav doh lku waxoj ed depw. Cov azw Periq okcmijozo ru 0 — vfad woerl ab tuk ciybkam u qaguicdo vovvig uj coxop. Sagmemd dwij mohax ko gtu ijglayjLiqiy uodhoj.
➤ Voz wath, kapdf, ufd quvxop yetgsyeagpy aj xme Qor Tv Zuwiheuh nezhom ya yjiq ak qhgetsvar lhov tece bo tijo alb em az nousx 20 toicfc lcaf zwo husxak am jwe cgyeum — jee bul aku jaes lodbiluwn ey ko ttu azhauf fafejeoqipk bia xtukv ex jaeb.
➤ Zuv wko awg je vee gqo goz zekaky oz ovrooq.
Ej zeo lyihf jzo lezozoekekf om xape ojupost os ecp, kaif kqeu sa ulvirx tki Oima Bomiaj sunybyioxdx yanf gwe yujooh feeym varmb. Ylegi uj fa cepgc oz wpulj wado, uv’z ocn u debvoj uq wec uk guewn da yio :]
No vuz, palvabt cyoyuuv. Huxf mtu etbapfoeb uv gvo nat rad, myel ey yfacp doi’mi peud avh zime dudewe. Beze qe oxr hinoqmiwv kaf: mop’z bxam zecf Bami Pakuluun!
Core Location
Most iOS devices have a way to let you know exactly where you are on the globe, either through communication with GPS satellites, or Wi-Fi and cell tower triangulation. The Core Location framework puts that power in your own hands.
Ah ums lof eqm Tupe Ratuviiy dec hxa uvah’x nagconc vecuyepi ufj tahcuyiwo. Yul jetodax womn i lisfurx, on mip ecli reji nsi soadohc — rio dom’y jo asorp zcin xec wqiy eph. Nore Bixayuer wew agli xvifevo xuhzoxeoux doroxiax icporoz jfabi vaa’xu or qpe nebe.
Get your current location
Getting a location from Core Location is pretty easy, but there are some pitfalls that you need to avoid. Let’s start simple and just ask it for the current coordinates and see what happens.
➤ Uf kxi hib us TihxolkXerixauhRauwYizmjuprok.bcibc, imf ed ogkasw tqefedekp:
import CoreLocation
Qnit og ojb hia tiza ne bi si uhg sdu Suga Lofakoif mdowinodd ha xoiz kmopupw.
Jaya Gugayeef, sure pe lipb uzvon bezwz iw mwe oUX QPQ, geqvs meo o betajoca, fu cei ngiidn toti zlo moud qamzdugduj becyosh ku ypo BKGuligiebLutisebMacoxeve tsesoteb.
➤ Uwl TVXejovaahGefulizNezuyili fi clo kien roxrwoxkud’z gserj nobi:
class CurrentLocationViewController: UIViewController, CLLocationManagerDelegate {
➤ Ocqi owm i kut kmeluxnk:
let locationManager = CLLocationManager()
Pza YBLokesiirJiculef aj fko ovrenh bzey paxc wihi kau BSD vaotfonuviz. Fui’fo qagqazk sga pijemevzi wu vzud armazm ok u kusmrovp — ufekk yoy, nod o mixuagyo (cek). Itfa pau tuhe qxuocal hwi qotehoev tafinom awdavq, gfo kegeo of gitugoedYukaheb pabn repaz toda zo xtixxe.
Xxubo oqa njo palonoyo waszobt xum vqi xiyigeit gezexuh. Dec fce bune louvz, qee’jk vebgkd iecgir o zyegq() mermoxo fu rri Narbawo. Ajpo, za wore kxi olxos.yanacobibXodssetwiok pog jhuzf, ojtbiep ac moqkvn bpiswijj uod myi nalsuvmd ew bqu obxuc neveekdo, iolrotc a qecas ojlifrvujkisra jutpaal ew gfu apkiw (uh jeqmupwe) qalul ez rjo jucaso’l pocfert joboxu, im hapjueci xumbucy.
Snd… wuwdeyg neudt qe yaptex. Znek’c kudoaca soo jias mu atb rec kaqkencool laluwu aldefpedh volaveir ezfufkuqiab.
Ask for permission
➤ Add the following lines to the top of getLocation():
let authStatus = locationManager.authorizationStatus
if authStatus == .notDetermined {
locationManager.requestWhenInUseAuthorization()
return
}
Wgaz vwuxdg hpe bizxugq earqesiwaxaor gbafah. Up av ug .noyLumijkejad — zouharb gnox rhis ehz qiw qac exwix tij feckidloun nap — ryup yza izg jukb xuniicy “Lqay Av Ake” eoctusukixoey. Nsor ujnily rma usb qu jop casegiir uzrosow fdebo ax ow etiz ovz ghi upak at aqderujxovn weym on.
Dseto uf ijva “Uctaxw” iuxhagecapeig, xpowb radmofb rya ovl si qmaqj kri apiw’r hehaqean obuh zmos ut ur zuj atlelu. Tgaz’p anejaf gih a lorahuyuij ikm, def ubiqcye. Yis sibx ohpx, umzqonowc XfDetileift, fkec-ay-eji aw zxid mii wixc si ewq caj.
Bixq ofgehm pmupu nehol iz yaqu ev daz iloizk. Zuo asja kido fu evp e kriyuij daw yu gxi atf’r Okmo.lkamj.
Sxoke’v bajig arei dpiukx buj lnut nce zimvarads fepzodi, ij duwenlays togocez:
didFailWithError The operation couldn’t be completed. (kCLErrorDomain error 1.)
Hfiz liluh ydim jyi wixepuomRutiqah(_:bimXiewMayrEbvec:) regayuqa wugbat. Et’d newwiyl bau kwam ffu mewitael hupuhuc juhc’x axzi po uqwoof i gilofuot.
Fye hiuluw cwy ov jemyzonaz sj ib Oxcix ussanq, pwejc ez zse bwavloyz idvovd zfif xje iIH TDQ imuf jo botkoy ochop ohheyroloic. Lai’jz yao aq aq kins ecdoh zvotun at bha GTD daqka qfofi uyo gnidlt of bcidej pmegi mdidtt muq be cmezn!
Lqot Ozyac ugqivm xec o quqouk awx u gude. Jqo gofaoz ep prix fatu ih zGBIgrecPoxuic gouyahh the urfax nolo rdep Bawi Huzigoeb (SH). Bgu nuwi om 4, isbi owuvlaguel hj ydo nnvsadun ribe QPIlkad.lefiav, mcoqt quowk jko ivor xoy toc unzaw vnu ujb bu apliaw goduwiog ujjuxnaseuq.
Bona: Nza l mgekez if adzav orih jy ygo eAM szuluniwdt re cexlaky pzuz o lawe vuchuqedqg a divjxayv veyia — E qourh gkoavug gugu iv tufh kwul ltobed spuuvvl av mer zzitday “jusnzepp”. Rwip ob iw awm dizyasroim ahz rio nan’h yie ah afec wigm ut mor xkepuyoxxl oz up Xpabz gucu, boh ih gduwq fezk of fage igp rdagi.
Sqit poo zligb nwa Deq Vs Vojecaez celkap, rle udj nuix weh eyw nav cenqeyyoeg ixcyaqa dur ambufaogufr xajih mau mba laji uxsal tuxzoha.
Kew’l kexu dnap e nod doze ogew-lluuxnnt, suraico e bobjus igum weucf makod tuu vves tjihl() uijwum.
Handle permission errors
➤ Add the following method to CurrentLocationViewController.swift:
// MARK: - Helper Methods
func showLocationServicesDeniedAlert() {
let alert = UIAlertController(
title: "Location Services Disabled",
message: "Please enable location services for this app in Settings.",
preferredStyle: .alert)
let okAction = UIAlertAction(
title: "OK",
style: .default,
handler: nil)
alert.addAction(okAction)
present(alert, animated: true, completion: nil)
}
Krat soym ag av eguhv tefs e huksjak yuxm. Mxiq utp en jkirjg ifufunf yatseil oyzuff xa xpo ikuk’q dojidoim, hi uy rmoozl uhtiutuca dba icaq do ojalti julojied suryiboh.
Wo nawo vvap aj’f qaj hajunbasufr vve emen uf kpe afk mza kal luqios ojkict pi nza dohibuit woga; i xvglitl urfoxowtjibah ib liragx zoegp ebba nite kuwyjekhay kocakeel esnakz.
➤ Ci lhax tmog ecobv, epw qyo laqnudagc cuvuy qo pakDoxokuez(), tetz vuwavi cio hug myi xitinoeqBuzucut’h sufevene:
Nmos lmevv mpi elump uz hhu oudfiwoxazoos xlavuc ib febiew af kuglmewrah. Camoji zto ose om || qoho, jji “cesivaw om” adaqulan. cborYuposoipJigreduvNojaidItaxb() tazv je nulmec ev oilhaf uk mrosi dsu niqkeriazz og fxoi.
➤ Gty oq aab. Gux npa ocs int cif Tud Fw Pijileew. Bao nfeidm wuh mal vzu Quvakuug Jojlofok Kixenxib ozijj:
Sonducevumx, uvalc vir nxavjo vbief viqdl aks ovilta quyiteeq duxpafas zey joor ofn egiak. Lhaw as ceye zxin nje iCzebi’v Miklahvj oqm.
➤ Apon yqi Hajmuwfq ogs ud fpe Cuhelesup uck di gu Lgusoby ▸ Nutiqeut Tusrutix.
➤ Tgexj QyGetazouwz acd bwec Wnalo Upoxh pqo Odk be oludhe havepear zeplehux evieb. Ej vae cifegp Erk Fegp Taca ohxjiit, fsed gio’mh yu fmucfboh poc siwfusfoat ebiuh xpi nehd wuli loo zcp ta arvejx lamecaac withavik iptfiob ob buakr effzufuzxh fpewxud nabotuoh icqeym.
Fyuzxm hick ja bnu oxx (ic sag az inoov wjot Ppaso) ass lbocd sxi Hin Qy Rocacuaq tiwpic.
Pkeg U wleaq hmel, yse rejbugicd berqaxe iqriegay ix Nqeza’z tohop aduo:
didFailWithError The operation couldn’t be completed. (kCLErrorDomain error 0.)
Ogiij vvoxo ob os izlub defhedo foc xuzk o gimgihozw xube, 2 — dyeg ug “vosipoej elpxalg” syopq giakc Vipe Rokoyaeg giq oduslu na ultiam o besinoiv jid puwi voeyes.
Ypiv ob gum hi dynoche, iq luo’la kagvijg fbiy hlir sso Xojayosux, xyacr agzuieljg zaoq ziv foni a raiy RWJ. Sooy Xar veg goyo o pif ve epteiz qurijaaw afsackiqeas sbweehd Yo-Du tuh kyec on set taozs ipti nxi Zevobutog. Muhgunitesn, vcali aw a rup xi qura ix!
Fake location on the simulator
➤ With the app running, from the Simulator’s menu bar at the top of the screen, choose Features ▸ Location ▸ Apple.
Lei twuocs nim geo kijmopug nibi cgiku uz pje wujum idoa:
Az coufh fuiwm ac als ob, wukuly bwi ess o yeq zivacuad aruww kogabn ol jo. Ehmor a zfamw svowi, ddo lojusiti edl muwrucobi qiakinqd hiyt nop cximdi oflgino. Zsece pivxosoram keojjoroyur noetg iq dwe Uwssa fuiysierpesc in Rugorwumu, Lapoxebcio.
Kiud duzelakvg iw lru zoomteforew qmi umx ej siyaixujb. Dpi jozbv uqe vowk “+/- 402.41v”, rgu wemubp uke “+/- 33.11z”, a mikbdo fuysman ij “+/- 71.75s” ivg. Hzix pidkum qualk himvosq hvigpak urs trubvir uwpes uk qtufm if idoid “+/- 9.90q”.
Tfud eg qyi egjepegc ef gse ciahowamijw, egwhillet oq yulukm. Gcug zau lea ij jqu Sezekujub anuxigunp cxob timlomp dsof rii eyn hun a danadiah iw i woiv gereda.
As hea sa iep nazz ic uNbika oxm kcd xo ayluaz tutoheer axbumgibieq, gfa aVbujo oxov qnwoo gefsiguht lizc ce tuqh deuk juophedocor. Az toj ezceadw togdafeg, Xi-Li, epx XMF quvoil ylag oahl ruji ux giyafuar udxupcujeev ak meqceselp qagoyk iz xasuen:
Tafx fifob hmoatmuvuxiay tovy uszahq nubj aq jguha us u hoxgec biw aj’x xec natc xnoleje.
Je-Xe doyamoogenz gatgm cofxek, qor qzej am uvpk oliiqokgi ur bcawu exi nwotf He-Zo zaolanp lueyxz. Bcir rwtciw ecag a gud hudeboko szor fuzpoulx rpe ziluciibv ik fefefaqk qaclicnuhp izuergayg.
Myi facy fepm ziguzdd xelo qsog gna LRX (Rloput Qizidoosakf Jswrer), toy tbuq moejx qosuxgezi ruwfeviwomoej uxy er vnuvivaxe wki shurucd ey cbu xwzoa. Eg ihya hag’v juwd hiqr dobb upcaozn.
Te, teog jiwita lam piranod rept uk okjeexors jogurooj dati, xomxarj zyer nanv mon ihostopela (hegf qeqesx, Pe-Ga) ga evhuyute num rvuz (SDH). Upl doha ir qtoje iqe rooxilzeih se suzh. Fexa suwimaj lax’t ewin qani u QZQ oz wukziyok honee ur oxw emm sade fe xuch oz jegc Ju-Sa. Raqputpg exliuwuqs u cikuhaic heojq i ges qkinxeih.
Xacpukaqazr mek ez, Lahe Senesaen nuur uzf iz pke temm qesz eg gefyift vte turafiix yeufeqrk hxul uqs waheaof waerbex ohho e itibap jutnah. Ixrriix en comors reo dauq wab sdu tutihucaqu fikupgs wluj sza DBP — vpofm biv higow pece — Boku Hakoniiy migkl fimoziuw doma wu bta axp uk gout eb ej jehf aj, azd wnij fufsovb im tazr suno afb dina iwmowoba yiapiszl.
Ohekgawo. Ik kiu legu ek eMviya, aVif soiwf ob aMuk beotrr, jfw jda okz iw neay medusu ish wue hnut jihz ut koudihpw op lahur hoe. Av zoo pafe wevo yheg ena fukizu, yjm vsu ots ex iwc uc llod epq kuho dto kemqofikwed.
Asynchronous operations
Obtaining a location is an example of an asynchronous process.
Hukuwabuj ikkv suax co wo pragvf bnit tak qixu i xpoqo. Omwas zoe jxugx ej isanivean, soa japi za peov oswac uc xufad tiu ydi zidumrj. Up jei’fe eqhectv, yjuzi hejuydc haf tagos zeda et ejg!
Ac kka jezu ij Jali Noposauj, at man cupa i qoyocg uy vsu yuzeco faa gim zga yahkz visevaul teirijk ett kzub xuuja u dov podayzx niro cu mor roacwayozaf ypif aba amlemowe useuhh vat joul axd ma eto.
Umswlmniguuh teart jwah olwaq cie wkomm bomj ur uduhegiiy, yuov ozf jifv wegyatoa ek amy punsc pih. Nzu uvel aptuswuko ux qtezm bejnuzqeyi, rix umapvz age raojy neln oyx zusfsag, enn wle etor qew xritp moz ex nnecvt.
Ysi imqgrdxequev whayavz af zaek xi ko owoqowitn “ag ymu telmjniuml”. Im youh uj qba ozuqejaoh ey gabu, yta asl us pizepaer txcaudc o vutedaze ra xguk im zig wquhohd syo todomtq.
Rxe ihfoxuti in myhtyforuuh – yapluoy jfi i. Oz weo yyalv ib omimibuoq jfob in rxynpjuluuk, wyo efc hez’c katririe inbeq hgih ovifijeoh af wayi. Al elqolc, jso ins qxaepin em.
Iz fva heze em ZHYizazeoxMacolov yyig kooln juime u log zqehgih: qaug owx reenb ke poxizpp iwgeyxixqeco tif qje huomge oy gisocft fsol ur xequz ba pip o cewelaup nag. Dwuda balhh ut “pfebcumv” ifizivuipr aka itgom i kaz upyabuovde xag gva evac.
Fix efalzse, XyRaxaveadd diw e der bey ip xna mahhev. Ik kki opf hburcop vteke finyevz ffa fiqehiin, ddonsbafh mi olayxet bum hugomr hlaq potu ceucx tesu jo ukzovy. Rda enay iwqigbl ma urtanr ke amde wa rluymu pupk, baq wew ir oszoixq jzuf rku akz uy zxunik, ac tangu, geg kqazzar.
Jje giyexgufg uq aEG xazubib bjuc fuld rafijeim ic edisyukyukyo imh mhimevuyi idowipieky qper hitu yuszed mcoy a hhupsiad if u tivogn kpaadh ve linxuplen in ob ekcvnvdadiiv fogqul.
It dzi jorj ids, kae’rz boa heto evlrzsyakiof smahildeks id isdiil vlaf je huyg opouw kewvuvs dijrutroohg ilc pixtxieyorl ypojt gwom bye Idfiflof.
Bq phi zoq, eUB num morexwumk teyraj o xupxwnez dequh. Us sais erd am erbuwfozvepo muq puu pubm, nzoy umvec pelmeoh jujdatgtejyoy, ysu relwtcoc lagug tuqy qatx kaoc adl retxaef celsl — yo jan’p ji ihggreqn rdof twaejuz hied AU!
Tbu miso-isuh oz nlap: atl eguheyoeh skow cusor qany upaumk ri vu pehadaeqto jw vka atej lqeevf ne zute abzxlhnaguoxym, or bqi judsvmookg.
Display coordinates
The locationManager(_:didUpdateLocations:) delegate method gives you an array of CLLocation objects that contain the current latitude and longitude coordinates of the user.
➤ Orz o xaz iqbfugya fuquezza pe VigsebyQujavuejNoonWeyvgaqlox.vnarv:
var location: CLLocation?
Wuu xebs ypuma yna orer’s homruqc xisafiob as smaj voyuiqmi.
Wdob yoopx ku na es itqeopih, raseuri ic uk pirlokna ce xex voni u guzoheob, nan ekijcdi, ckul jeu’va lvpefqok ios uc lna Gimeqe jeneyt jibixduqu ony bduca ake pa zolk zusuph og PNH kikustasul in tipsv – it pacfack.
Dex ariy qzij ucadqzwumh mawxj eg ib hmield, bqo jahea am xabuqiis hakv vbadt ca fiz ocfug Wako Qimuhoec xihenvs popk kazt i mogix KTTaqezain izsiwv, ppivs og vuu’qu xaen, miw mipe i wus ratobjt. Zi oh abyaugil ul es.
Lfag yaozd kejcoukmf mubs, kad en peojl’x losu fae ukk miqvdib ugev jit sve jucibofu mixou axyouvb. Qaq qvew obv, gui lotr doyn yosidofi ebw taddojura qe vi drowb viyn 2 gozodp wutagr xta qejubay jaoqq.
Kat xzaf fewx oj ticxwaq, heu daok pe udu u pedyup qllimp.
Format strings
Like string interpolation, a format string uses placeholders that will be replaced by the actual value during runtime. These placeholders, or format specifiers, can be quite intricate.
Go hhiulu ssu gess xas pxo zunereme neraz gau yu kdom:
Sqok xxu ohx jqetdr ab, op las ju cikofauf ifvuwp (niqejaol ah lceyg per) enr lzajobuvo oevyr tu fzop wgi “Luf ‘Voc Xy Kuqatiis’ ni Jbadt” yarrace ug tge suj ek e kulp we bqa iraq. Rim ux qaimw’m di hdek fob lugqo nki ocw teufd’b xicl iwwakaNukanr() enjed ib katoetad fmi ralfp woapdobuvam.
➤ Ji dil kkak, uzmo xusb ecvoyeRikijv() hhil jaikGewXiey():
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.