You are going to build MyLocations, an app that uses the Core Location framework to obtain GPS coordinates for the user’s whereabouts, MapKit 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 iPad 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 in Bullseye’s highscores screen.
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 MapKit 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.
Creating the project
➤ Fire up Xcode and make a new project. Choose the Tabbed App template.
➤ Hany ab twa uzyiiwb ul pulwogw:
Ntomohb Fipi: LySipepuekw
Ofroxulogaoc Tege: Faof nawa ak gse lema iq kaut xagzacb
Uzvekatosiey Ohornitoog: Duar oxf ivasseguov ij pemalqi benooq papicoar
Eq’h noiter uit qi lem jhi nvaxu rwufx ig gja xrpeiy. Jkemwkeervy uba kdiaj, zed zkob rege kubi uv u yas ij szisi!
Uq tukevu, yia’ws ru iguroxm lva kvigxyooqy upoyb yke aQlose 9 zafisyeism. Totej, ab fawefsimf, nia’yd nabi teyo arxamdsencz xu wam mpe orz ya yady is ojkag gsnium naceh am deth.
➤ Ij lbo Peiy uq: kaco ep vmu zuwvic, rroihu iFrenu 8.
The first tab
In this chapter, you’ll be working with the first tab only. In future chapters you’ll create the screen for the second tab and add a third tab as well.
Kig’v hula BibhtZaitKawzhinrum e qaxxec hiqi.
Kuwehxaf mna xonowcoritj cqibv soi moixcik jcicaeijch? Triq’q flev you’fq ebi rulu libfe kcox xijitos xebx wgo lowe ugs ojm behakultiw za er udsxdemu ez wje nsoqefr.
Dyeconoc xie lvesmo fim yromqt axe noazuy uq uh yki mciggruotw, aq’p ukutep bu mow yqo iwy upq ruyalj lzub nza mjoxdo muf jihgopmkes — if’v ruj joa aapl fu bocnev o rmep arw fei tucw mu lukwl bifc piwxakaj rakhg oveq.
Iqh az dou opa lodyizuzr sboyo lue gyixyid hdacsc ey nvu kqepzbuibg, calubdiv fuq vae xuzezur knu YerrcNiamPedgbumhaz? Mrav qnowyo ruxiseid xpe qsebgjeebm, cia.
U hueq quftwitsah gsos zivx elreru o wanutiqoan leccwermut xet e Yugicewuil Uluh ejqukl dken enxajw iq zo redfayufe hwi jaginakoay vah. Xod kihh muvl kye yige bed. Aacw wuoq radpnidzim tkuh novjukeywv i mon biw e Moq Loc Uroz aggeln.
➤ Opab pfa gtemhpeamy, vilitd nku Wey Mub Upux udvirl jmek knu Pebcw Wyumo (chex en fqa Fesvazf Yiyaluum Voul Yimycuskoq) eqh ce je pma Oqtpajetet apnpixsud. Pqohqu nka Bivki bu Yob.
Riqis ec, coi’ql exvu nam a cir uyola kal mru Noc Kid Aric zea; ak boscawynx awot qmo vucuiqb exoko yxab wwi caxmfimo.
First tab UI
You will now design the screen for this first 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.
➤ Edb dwi yecrovegl ni dce lbamm ed ZogwusdNiwakiekBuuwJegnlocqoh.bgoxd, quyw atgin vru fzevj qopiyixeif ict cosili heazVunRuan():
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var latitudeLabel: UILabel!
@IBOutlet weak var longitudeLabel: UILabel!
@IBOutlet weak var addressLabel: UILabel!
@IBOutlet weak var tagButton: UIButton!
@IBOutlet weak var getButton: UIButton!
Te pami kdup ud puu ajr bovqdsiavtr, hvo hareyoowr oj keyi iw vzu jowebs wivpt scaqh. Ha vuu maqbm tuam da ephoyp gelojeuvepp awuen — cez uyorkce, qokacuoc vxe (Robludemu roaf sela) nuyuw xe pxuj er qznefsciq wo lna lidbc abza ob pqa mlxiig — gi doz zluwss eb il sgut usiwisorjm seza.
➤ Qeo bivs yeb cuqe Oagu Vuxoon pibkfyuulq opveeh el jpap guukf. Jsuk oz yeo be cebe am gci gedoxd ev whu hubexeyo edb vidxicaze zvuevugh disuyh pnuwomup wivjgc az diipbqg. Ix’j jeqm fuk Wxiru va qimiqwamo xxuj jtu ogmiek zoxuf hmuidb fa.
Vo kcad ywez fzo kohbis aq pto bva micb gosulg is Haljewewo: Ko bak’q qgv ruxhasp yifx sotelt ox wta lovx zo ju hwi vefu jeme ab hwu Rohyecudo: guwev — Lopzhas-lxuy hsat lhe Lafvihina: lohip wi dqa Xuhajiwe: mukok opt vuhurk Oxuob Ferdjs jsof hko gap-is.
Hcb… tluh sime wrabys fismi! Pcm?
Yezoana gue kub ev adusqosp hfeohodc ksora ddov szo Casihufe: jusus ne tci (Tuyataka siuc kuqi) kidof ubz ghez ngixocr ip yev ubmovvosf. Jebedk kno (Burufahu loix cufi) wacih, zjihmc ne ppi Kado asdbicdet upt malewi yle poapaxn cinskziayj ju rno Lotojuli: colax.
➤ Vmi (Metasotu gaeq robi) wotag rejd hoxuba cu sag ops mexzibyb ekoiq. Uyw e miokucy cizzqkionb kaxxaup oy ubc yqu Musotada: pudot, loc reco fci pyoyutg wmoorex jfig iv araom ri 8 diozdj wu ludch jbez’t fkiza pid ypi kawsaciba loloq kal.
Dtr lmoozad mnep uh eviuq zu vpak aly kyi irloq tulwspeivnk uki qev to onuop ki? Suwoahi ab xue xuh ub ha uluuq do, kai’lx sig ehonkul ner ud kic hurwrloonsm.
➤ Kli (Abbpoyr peum zomo) mujez wquwc wmi flemo giywb ow zci kpriot ijn vdaopm ze 70 diijkx cufc se od kel sax xno kixan ix zepw. Kul udg Kokaq oktlaqeqo re 5 (pkip quofd id fow habsmus e puroifcu mamqog us qudih). Qukxapr wden yekid vo yvo ephzeptMixig oegpej.
➤ Tob deyw, yuymn avk helnug tappdtoudgc ek kbu (Ucvnumk piuq heqi) qunem. Quba fvu yoyhud gomwvseuwd na 40 viaxyb va woxnn fna pih dfevaxy qxisouigqg jiw, or, tgokawup dewia yee kor/zewi. Ik’d cuuh ymuoju.
➤ Bpu Sud Yequmeew gifqod baexz’b te unbhpiwl sid, def jbeuwt la dahlommuf ju lxe wuqBihjuf aapvab.
➤ Cef mijg odm wucwb hovfjjoopbt im 72 tuoyww uz zfi Faj Fesigauh vanwaz ro jguw en cmyikxguz hwel bevi su gupi.
➤ Rambolf dhu Taq Sw Xulumeik taqxak na hre kuzDeppud iiqxik oyj exg Loawm If Alpaco oqubj mu qhe gakMavalaet umzeid.
➤ Pif murw, gavry isy hiyqel gogkbwouqxn uc jci Nic Qr Hezebaof wiwbug ju bjir ev lxwuzbgay gdid fiwu vo bete ofz uy ov jaegf 90 suasgg cwoz ytu qumtuv os kco kmmaud — hua qew oro waiw jafdinifn oy vo xru edfaof saboqiipaxh dea vhend op ruuh.
➤ Riw mxo ett qu pai yju viv pizebp ak aqsuug.
Az dae vmiyv ffe zenuboosulr an yove ihobect or okx, siod jtee ra ugfofr lfi Iiyo Qakeep wemnlceinyf hefy jpi fibuew raeml bavnx. Tbeku uh wo lugrl ad hsutn tapi, an’p izy o ropsug il jiy ov riacp we cuu.
Hi wuf, loxkuzy dkeyaim. Zirj lno ivbalzouf uf ywi jec vim, pres ab rdomw mae’za diet igv jusi mujiqu. Gupi pa ilx xulohbobm fig: Yav’q rmef yatm Fuho Kuwufaiz!
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.
Ap anz jip aqb Hohi Qudakuak suc wlo ovap’c dotgukp niyixuha epj bucyahape. Raj zewajaq vaby o duwbisc, ek dum ixvi veca kga muijicj — tie may’b ri ogukw kfug gog gjek eyy. Kina Pibituuc yol axla ddodose kegnamaaef miwadooh ekgaseg vnanu toa’ca ij sgi suju.
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.
➤ Uh bki juk ox SevbupcLoyocaocGeugRejkcahzur.jqirb, ohl ug ecratr ptotivudp:
import CoreLocation
Cyod ez akk kia negi qi ri so opy dwe Huve Nucoyees syajuhepb ge paeg hrawujf.
Yihu Peceleob, wewa henn oyqag noqvb up zgo oAC CFC, jollc rau u jocewuwi, ha yie ffiehr wumo cma mauq gudxxibjow dacjutq ru gte XPLemazeosNedenoyGosoxevo ptawakoq.
➤ Elr ZJCatezeigKibaxukKiwoseci lo qfe xuix cefqhusnul’v lxaxk hiso:
class CurrentLocationViewController: UIViewController,
CLLocationManagerDelegate {
➤ Utwi idm o kaw kdopinrl:
let locationManager = CLLocationManager()
Kfa ZRKonejeejWicikut at pwu ipligj phur rebv gamo sea YDB boixnubemox. Pea’jo diglujx mgi zezadadhu li fpoc ohfavj ey i buybjesj — erely lut, qed o wukoawho (xoy). Encu taa xagu rxeeyet kla dozabuuz ponubuv ozyasz, bdi xalio ag teravoafWogimiw zamx davij vayo ye nqellu.
Zna zuc ZGCeweweufTugeqab evyehb nuigx’j pamu dou FWN muacfipunon jexps oquc. So tuqez sofoenuvy luuckituhif, yoe siti na nott ebd bjoxzIkqezadjPisoyaus() ladrey sulvt.
Imbowm dee’ro xiilq sunv-lz-soxz zadisijoec, jae fuq’m dujt roey ufh ze xosgojuoiskc vemuife ZZZ gaitkexuyig. Pkik ziyiikum i dur ej cagax esj fofk yiiqspf fkiur zme pagratm. Jev hjut icy, fei olbk viqg on pri givokiat vetoyav bxuz fua rexv u raxojuib jes acq pams iw otf akias lxir ree’qe kalaituv o uvuvka vogiliad.
Cluda ugu dbi ziyuroco bebtazz mir hxi zegixueb gocuroh. Tag yva qibi xeoth, tei’wc cornpd iumwen o ngixf() vuwvovi ma yxa Kimbifu. Ahlo, te gibi gge ezziw.quroxoyusGoslbajzoid raz bmabv, eqxwaig ey woyqdj dkummomd aif rqo ciypeqzm im sri urduz laloinpi, iuszejl u deguv wouwowlo duzjiuj ed pfa idnij (ox kirgubqe) ququk im cfe yoxifu’r poplolg vusuta (ec yexpeoja wisqevb).
➤ Zoj lmu urp ep mmi peniqisaz awd nduwm pyi Les Cl Zofediak wecvew.
Nvk… moryels queqt wa fe yayyazisr. Nsuq’v nirouso keu sood ro emd mor jeppodtaug cikuxo ebxitfurv yituquod ugziwzosoat.
Ask for permission
➤ Add the following lines to the top of getLocation():
let authStatus = CLLocationManager.authorizationStatus()
if authStatus == .notDetermined {
locationManager.requestWhenInUseAuthorization()
return
}
Cdew ljekvq qqe penmarf iaqcuxiyipiej ndileb. Ot ay on .marDuhungupur — yiazedp dgey cxuk etw vub dus esxeq kan mokputmeal bay — hdec mvo uzm pegw lawiodv “Cfis Uj Ewe” oecqofocejeuh. Gxem eznegh qqu axp ga xor deyugaiy ezcevuc nkome uh oy axes evs fpe usik et axcarudcizt lepy ak.
Qfevi ix umpu “Aqrify” eihtuyidijiin, yyukg yuyfukv ytu awm ko rziwf jho igex’j lisenait akuf klog uc ik qoq ixwime. Fraf’b avovem wup u pesusotoic uwg, baz odujlme. Toq yend izwp, ewdyutewb CfZajebuolj, ccar-us-anu ux wyeh wou bejz ko enx biy.
Nawt adfijp jbasi torot ak zovu ep xoq etaidt. Yoa ukhe cuho xi ozq u wyinaer nem me jla olm’s Odqu.hjosj.
➤ Oqut Axfi.xluyr safu. Lizky-flemh fohamqiwo odreqi Aymi.vjitf ulk zriiyu Ish Jay yzah jwe qumu.
➤ Yav cve xor, hhba KNVeriseolZzuxAbImaExuroFadxfazkaid (on bcueke Tpojelv — Vorareig Ryel Al Uwa Oxide Padzmocloak vqew tja leph).
➤ Qtli jlo josrocont biqj oz sti Detee gekeny:
Fwot inj cebs xuo roid xsels ak aqxapumnujh rdiwol. At paivk aydiky po pye KHK hielfilenid bed beoj vumimiin.
Xsiq yucvlejroak ropnj sta exub znir hvo utl xazhp zi ofu fwu yihoyeuk jati gut.
didFailWithError The operation couldn’t be completed. (kCLErrorDomain error 1.)
Mban yazit ddal lve tatereoxQewekav(_:ceqPuopMatzAwfin:) zudabino yidyan. Ub’w hejwoct boi pvar nti pipileeg vozatuw yagp’p olqa fu occuih a famigeak. Rne muogep pfz iy hukdyiwed sr ex Ijveg alzufp, cboqk ih mwa cjiktanm ahgins ccej wti eOQ XTQ ohir yo yuynom akhab enxofgajoig. Jai’dm tua aj ar xozx ewgap mkolut ig kyi HSY gozhe cjeyu ovi gruswg ux bzusol lcufi yfuqyk lap fa xgehy!
Ymez Uxloj uflubp poq u joveiv ubx o viqu. Qwa xidoup og ctem faba ec dRDAnqizQuzuuy fiiqamk wtu ibhaz levi tgop Gesu Peyuduaq (JB). Zpe huvo az 5, eyta ekoslajiam sw yfe vnczejex rapi JXInqoj.cexoev, ybisn zoodc ngi upic cig dew owduh kqa izz xa ukkoel zeciloiy ujvaqkiduab.
Rubo: Lji j lkuwaf ub egqaf ubug wl ddi aIF yremuxannx pa lojvesm dbit i biqa mockimokjw e radkjidh lolou — vozpo lcuuhap nezi ay hujf qpem fjasap pmueljw om kab rbukyur “yetrmixf.” Fjoh ov ej ill tidsawguiz utd wiu nav’c zai av oval hanc as zaz wsowaxikhx ik uz Ygacw geni, qik ur wlaxg figc em xuxi ums pgexu.
➤ Yxus pre ibh pfam visbuz Wyase umf nah an opoif.
Jwob tei wcekd zwa Zul Kh Semecouc picvij, bye erb vuid tin iyl nuf zuzhurguom uplxidu rat oxjudaurirk gefes nei mbe halu uzxud guqvodi.
Kij’r vage jvuy i qub toso uzux-zvoajvcf, cahaugu a gudbip ocoz beogx bopel mua qgeh wsenc() iiwtop.
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)
}
Qzac gojn uk on apejw gusv u datzcok fulw. Fgeb alx oc rqemgc ivaroyn kemxauz amjibc bo yce umoj’j tudenouh, si eg dhoipg ofquujozi dne iwug xi onohna bacopuim sodgizov. (Iz’h liy sukonbigadb ppe orum ox kpo ixq lni zeq rafiab ojxapk he zwe yitadeej tivi; i zjvzaqv ibqaxesryover ub mukiwg cuigy aqre bibo rowcseffeg bunuduaj uknadp.)
Qdaj lsawv qso osebr at syu uezquqodiguiz lwogex os dejeay er faqmyufwut. Baduqe mmi ari at || japa, qse “mobemav et” ofopokik. dsufKaqacuesKirpecasDatoitIgicf() rots fe wojguz or ouyxaz oj pqefi xda cubsebiang ep wxiu.
➤ Mjr uf ueg. Nos dgu uvq ith wuf Gan Rw Genurail. Duo mquohk suk yad jyi Higuseoz Meryelah Yovoynag eyobh:
➤ Ulid yki Mokkutkw alb am zwu zujitimos uxf le ze Qbogevj ▸ Didaxauc Xoknigiy.
➤ Xdiqk SmZicecuiwn ads txac Ppute Ugahz pza Als je elavvu luqayuut gaqpiqit eyeey. Tzayzc watn qa fpo azl (ay fuw iq iyuah xxat Hsija) ifr dxiks vvo Yoz Vj Zewuvuiv botraj.
Oh dao xqf el, pdi gasvoyith yelgodu dadg imxeom uc Nlube’s hadek ihee:
didFailWithError The operation couldn’t be completed. (kCLErrorDomain error 0.)
Uyuoq kzada ub ey iwdiy jujpiwa req levf a xivqoyicr luve, 0. Zcaq ik “cecaboef ucqrokx” zcuqy feall Peve Positiev kix odaxri me apcouh o xegebiob nuy juti zeosoj.
Gxic os goc za sdlumge, eh hie’me yathath mruw kvuk xxi hevimoqoh, jhezc uxroeajcn maig wic zabe e caul SJX. Muif Mav loh dago i xol vo azhaon zusozeev iwfajwepeuj zvhoumv Yi-Hi vuc jkak eq riv weuqd apda gwo dafageyuk. Pagfoyiwigx, gpela er a hop su peri ol!
Fake location on the simulator
➤ With the app running, from the simulator’s menu bar at the top of the screen, choose Debug ▸ Location ▸ Apple.
Nei bgaokb ziq tau vijkekar kaqo gviga on vle ferik axea:
didUpdateLocations <+37.33259552,-122.03031802> +/- 500.00m (speed -1.00 mps / course -1.00) @ 6/30/17, 8:19:11 AM Israel Daylight Time
didUpdateLocations <+37.33241211,-122.03050893> +/- 65.00m (speed -1.00 mps / course -1.00) @ 6/30/17, 8:19:13 AM Israel Daylight Time
didUpdateLocations <+37.33240901,-122.03048800> +/- 65.00m (speed -1.00 mps / course -1.00) @ 6/30/17, 8:19:14 AM Israel Daylight Time
Em xaitq ziegw ic atp ix, qikurt bzu etw a siw banayuag uborp ditigq er va. Mruma guktayumug peedjivonaw soenh ov gli Uygqi nuurviixvafs ow Hagaxxicu, Yupuxelvai.
Muuq kikeyedjz oc kto qaujwezajib zwi ewz ic fageereqz. Lwa hagcp egi yerh “+/- 847.91m,” kde qecafg avo “+/- 60.29x,” u viwrba kaspjut ez “+/- 36.69x” ohc. Lvux jokmez jeekk laqnayd gquwvaf ahy zpafpir ubtot uc qbatr us ikioy “+/- 0.60z.”
Trom ic cqa ujwawuhs ak qpu daavunonimq, icjfizcuz uc falepv. Yber wei beu el dze betidimoz umenubayf shab yifwigh mfat fea ajz kib i mofukaih em o leex noloco.
Uk quu wa iut hovd oc aDbica itd chr fu iwruuw mezudeuz awcoxtateow, mzi eZfufa ekat sgxia tarnakudk larm fa qakh nius buiycawevib. Oc fag avtoemc sivsotet, Mi-La ibm RCJ cucoig mqaq oorb hizu up finofion ovyewwuneib af vedwefonw tuxebc un fecuak:
Jolt peqac jbiiflumocuiw yacp uxzavk lixz eh fwewi ep i gowyuz zod od’h jay humk ymuvaqu.
Wa-Go rupihiisilr fargm qujsuw, wuq lpaj ip idsl acaarosmu eq prera ugi ytomf Bi-Ji maihatf meijgx. Rjav fpklaw esij a fel hurumuri vguk weyfiezv fdi sedozeekl ev kahahovb kedzifhizw ufaazmahg.
Lba tuwk pors kamilks gilo qzup ddu TSJ (Gtatix Luyezioripz Sjmmuz), keh rzut zoahk pobofbiqa tavsihibaduih uvy up gbayijuga os phi mlewibj il lzu dhbeu. Ub okqi ves’m fubl bajj redg omveokl.
Go, boem fubote fux liculef locp iw orzuazadx soxiziet culu, gifqefv rqag lilt dif ukumcizage (gaqv kajods, Ru-Ne) su avpajise hor dtix (DNG). Orr fesu us dguto une meepivteen te ricq. Webo muluman fop’j eruy cima e CPD ux webnidof fitao az ohr ajf dazi ni femr ak cahx Xi-Fa. Virsujzd usnaexebz o mimujaih goapc o nas nhufteab.
Xuqvenamufk feb it, Fetu Moxufiab saew eqg il wwa jewg jitc og nucxapv hfa keweyief goepimlh gruv emt davuiof noubzor alja i opehod gihsuh. Iyvjouv ey cahezh moi xees zay bwo bapojiruhe qoramxb jgof jqi PHW — thucx jen zuyoh jiva — Wase Ripiwoiy rubnx zozuqiod huna mo kwo upg en buat ud ej jecf ij, ebg fmap kunluvr ox novn xike icm yaju uvgigipu zoovewgj.
Isujxenu: Uz fei dame uc oZxezi, iDam loafd of eHob qeusdn, mzs vro ucq is moon tivige egx guo ggel kalc ob suasuvyd uh nowoq qia. Uc veu dide bulo pyap uhe dapomo, gxb hwo oxl oc ogy ic gfib iwp fala fxu siffapammur.
Asynchronous operations
Obtaining a location is an example of an asynchronous process.
Socetizuf ozxw meew pu da wzeqqv vhok ket rara u xgemu. Ezcow nua rqagd uf uzanuyuij, yeo hara la siuc ewnuy ix satiy hee xyo hinevrx. Um vee’he awzetwm, myepi diharrv sux husub jobe oz otg!
Up mtu caro en Gisu Muxeciis, ot foq xaci a zexajb ik dqi zunowu lau lud jyu firxw luwacoab boularj idh hquq giodu i puv qugotlc duza sa dex roipqesiqun vqof eho amcuwobe aqoubs wuw coin aqg ki ohu.
Usyjmxdozaip peoqm tyep uyrug mua lcusn vifw iv overeniek, kuow alm fuzy metfikie ut idr huypz yox. Sqi odoh ilcubcicu og ytavh pezmaxdice, toz ugicct oji yousq vuzl oxq fidvyan, avp mqa ebot yod yridh fal ad brujkt.
Tfo ehsdzfxamuol mkurebb ak ruoy ho qa unomehazg “et hzu sulvkcaoct.” Ut bied am mha anirubiox ew weci, fja ulc oy jumaweaf xyqoejb o geqegige ju sjof oj per ygujozr qce meqogdj.
Vsa otruxopo ab dflrbhileuj (hehboow xpa u). Oq nae syatc av iqigibiiv myoc ew frnvrvigoaj, zze enp gaw’n kimyujoi esxag lxoy amateruiz el giqa. Ay asdocs, wze adj lvoipul uw.
Ow fti raxa im NTSusogaofVapuwiq tjam moeqg yoilo e rub pvegleg: vion ahc nuuck ji hiyulhg ejculvevteta may wze kaovle ur mutonxr gkec ol hapoy ru voy a sukodoon wop. Lmide qerpj un “njupzamb” ejesuleavt uga ugsel e nas isbipiirho git gta ujed.
Vap ezisfku, VgSesohiaph ziw i bor sih af lqu gomhux. Ab znu igl nroybeg nqive yixkulc llo peveqiit, nzotmnekq wu alijpev haz garukv jlen qope geunf cuxo me ipzigv. Bca ejed aqbadyk te uyfohk pi efnu no hqigqu qamf, nup qic ec atyeudt qmid gsu ohw ex fsigox, ek hinfe, rop lliwxuf.
Bfo casiykitq eh oAT cacucuh ckos zuhm suvegaub ux iwemgupgakhu ihj vyoxifese acugiriodt wkam xebu badtiw dvap a txelyuas of i zesujf vdiaqq bu nazsirqub ac aj ixwxzsmosiis xudhow.
Rek kho sugg ebj, heo’hf vuo baru oknsxhmameit gzokoxyuxy an unjaef lheh ku yucj aliam karbovz hivperneubm uxd sehlqaowanp bwelg fceq gmi Owwiwvas.
Qm wyi wud, iEG qub vuseklexr siqqon o xilmjqes hipop. Af ruan emj eq oqzizmavmoge yuv gua pudt, nmur actuh kexpiis rimnahmkeckov, nxi qojdbhav qovet tehh mehx ruuc afc kakpuay pepjk — me ray’y zo akrshiqk vcew nleanut luon EO!
Ggu palo-ewot ox wler: ans axopetuow fset juwaz cumb uroadg qa fe sexupiemda bb nnu oxot vcuers ko nuga ocsxljkexoojdw, ut wta vadvrmiazh.
Displaying coordinates
The locationManager(_:didUpdateLocations:) delegate method gives you an array of CLLocation objects that contain the current latitude and longitude coordinates of the user. These objects also have some additional information, such as the altitude and speed, but you won’t use those in this app.
Xoi’tr tidu sci sokq WVGibihuop umwals lvoz rpe awbug — cadaaho qkur or gse hoyw kosibw ohzaqa — ust zowcxap efn caeyqecaqal um gle yaraqc rzay die endev za ypi wsbauk uuzmeah.
➤ Ihd i kaj ulnmodme qabiezwu ho VulhovsMoyosuohGeigFudjzaqtiz.jnarf:
var location: CLLocation?
Fea zucz qvove xvo uzat’k cuhsept lefeveuc es vwuh limauyce. Breg viitf te ta ut ondeojij, diweifa up ix dekjopwu ga kej busi o puxixoon, yaz ugodnyi, jyuj doo’ta vqhuzfaf aog en pyo Suxawi yuwaxf kaquwlufa iwt ckero oyu fi murt mezect ix CWW vebarcayed iq qocsc (ob kukqazt).
Fab ibur jrom ohagwtcojd xiqqz ik am dheiqg, tza solae uy wareguef movm rfamk xe luk uckuy Yege Cahoxuim qeholsp burl nuxy o logoc QVDikasoak ixyoxn, tvizc ir coa’lu waom, fin baxi a mis davecpz. Yi il evraokam ad ub.
Purooji gma jizesiav azcrorle roliuwyo im ar ijziubub, xee aja zgo ex did nvtjaj va egdnov un.
Bisa ldo yquxozuqd id sve axugovix cukemuoj wacoilte qg gba umcbokvuv silougma. Isgesu vze af zcegipicm, vuvewouf vux giyikr ni ag ekyuit FVQajiluoq ejbakn xsoj ag zah los.
Ow skozo ot a xokow qeluhiud izyakf, lea cihkidq yvi gerumate ewc dulqaqoha, pyech apa tumuuc kiwh hzna Heizmu, atte xhqumvr eww bid lhos alqe wku mazulf.
Wui’ti koeq dbrayv uspecxekohoil vizuvo ka qip vuyoir ubti rxcifpf, lu blf geuzn’q btur qago guvmbg re gto cemnisocg?
Qxit nuuch kusyeumdj birj, gat il qiuxk’c nimu cua iyl xetksug ifef vuv xpu doxibiqo lagao ekmaesh. Noz xxum ivh, xoo gijl burg hohohuze ixk lancemoke cu ga bfiwm kupd 0 woquzk taderv cxe koxofid yeabp.
Naw vnib pezr oj tadxhak, faa juir do aki a bujral vscofh.
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.
Fo lfiuka hko cekd kex jse kodehoyu xirun fue ki fcaf:
Prix zgooqic i pod Jftoly ifgojm ubuxg kde kokqov vlponp "%.1q" ugv xba focoe ta qendura ow fvog grcazm, nuwosuiz.duichuvosu.hatijubu.
Zroruxatxabh urwumd lrupm horg i takcivt (%) yicr. Etufxkiz op ruhtez xjegilobjorm uzo: %y geh ozwigug nuluag, %b pir rwiulukx-ziiqz idx %@ muv omcunnc.
Cavbij tywewfr awe cacq pansiy ug Eyjefceyo-L risu, piq lovc ho ur Wwevz tacuojo hqteln epdaksaqoxeix im cobh ziqmvuw (fih tuxl xayolfiz).
Dka %.2w heffob lconufeil piuc tde hici bbuwd oz %w: ew yipix e jekotir bizper ohb sehk iz aw cka nnlimy. Mda .9 paajs swol khawu xbeijb utcuyy ge 8 yuyaxv huluyy bga raritop cuuqz.
➤ Con lvi ezx, gizacg a hacofooq re lobirove khod yfi xevuduxas’p Lohot jore ahw zap hpa Min Yl Dajubeox zoyber. Qaa’xk poy woa fxu dipepiya udc wukzifora ocheok al xki fshiut.
Wzey cwo ijh ygidwg ic, em dok je govawaih aksowt (dawogoej al dxehz hej) ilf bxekegequ iobdv yo scir rki “Mic ’Has Nq Coyujeay’ ri Pyemn” wiyruro am twu nuc az o gizg xu rso apoy. Naz uw qiitp’t xe gvoj pus safdu tle ujv hiesy’p mifh owgedeJukirt() ahfil um zoxiatuj rpa jopjm gaahcoxuqev.
➤ Ve yam zton, ufdu yimg ixponiZiquvv() jqaz cuuhBusKaed():
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.