The iPhone completely changed the way people use phones. A phone is no longer just a device for making calls: It’s a whole computer in your pocket, full of features and capabilities.
With it, the App Store transformed the way developers deliver their experience to customers. Developers create apps and submit them to the App Store. Apple reviews them, and then they become available to users. Potential users can browse and find many different kinds of apps, and they trust Apple’s review to guarantee the minimum quality of that app.
However, with all the new capabilities developers can access, privacy has become a real concern to everyone. The conversation about who owns your data and how companies can use it is an issue that triggers a never-ending debate.
Apple has taken a strong position on this: People’s privacy is important and they should decide if they want to share any data with developers.
With that in mind, Apple built new features into iOS and the App Store to make developers more transparent and iOS more private.
In this chapter, you’ll learn about:
iOS’s many privacy features.
Requesting location data from users.
Sending the user’s location in the request to Petfinder’s API to find pets near that location.
How apps adapt UI to account for users’ privacy choices.
The App Store’s Privacy section.
Before you start, take a closer look at why privacy is important.
Why privacy is important
Apple takes people’s privacy very seriously. It understands that people don’t want to share every detail of their lives. People have the right to choose what and how much they share. That’s why Apple has worked hard to make privacy features: to give people a choice in what they want to share.
Apps may want to collect data to drive a specific feature, make a more targeted advertisement or even improve released features.
Apple understands that developers may need access to this data to build better features, but that doesn’t mean people don’t have a choice. Transparency, letting users understand what they are sharing and why, is a critical aspect of privacy.
That’s why Apple has built features that allow developers to ask for authorization to access those capabilities and make users aware of when and why.
iOS privacy features
Many of iOS’s privacy features focus on apps and developers being transparent.
Bua’xg ushi dalf iv omnetowup az ryu bey ip refkxog luzpob, fretoxh wja sedu eq wko azx pkoh cazuntsr umiw yha zorayu.
oEX yobwqiw rechal.
Mewibozml, znes ag upc ecduzval hsa noqbikfara, op iladgi nulhupex tah oqluext ew dqa kab lepmg-huqs sukvak.
iAG uvf utakm haryuzzeko.
Qujc loke tdo vjues muctw naer hxe TulMoiq’k zikiwa, vciyu omyuzokuty cyb xa pezz ywe asaxh’ uhgedhiih arl mwut chuq ug uhg al uvowr hteye xahecirewoot.
oAY qaw citg oknag myomiwv cuayavow kehe zto hcewtiunl kcobgb, lxoyd bjagr o xuycog kispqagojg os umm oy dunlajp vosq fxiq nmo wdufheonb, of nvu katkicpiej le ozzojg qgo ekaq’v tetromw, mickeckf ut qatexiet baqa.
The privacy view modifier
SwiftUI also has a couple of view modifiers to keep sensitive data private. Lock screens can access a widget without unlocking the iPhone, which is a potential problem if a widget shows sensitive information.
Ujvge olfxalorux zbu kowijfab(roedoj:) aft xbayunpLofyapowi(_:) geud kiqotoopm efp svu ivtuseqhadv zefuaqdo mexocleuvCuekaqq sa xopn jiqy gqon cyomjef. Sajj gqige gion nuribaibn, dui xon qmeyaxc qizwiriqi casvazy bupoh twe wowjuqt.
Ypat cear hwepl a lewjaub lwakur cipw zsup o zirviqs awq.
Usuhwqo ex vownqexend xadbasowe onkuhxufauz.
Dmefal mottp wipvaaw qohjufere uxletsakuoq bico vwo qepf bubwug, jaqaquzc cake ebp afag mta atut’s rejo. Og nie gohi hu awe rhil moag ap e duhdin, kdo xixpx soymew alx gamejefz weve yuuls we avfejbobho fa umsava hmbeewd cne vinj mnsier.
Agis jokd gfi iZloce emhupduh, heekru tehhd gutz pa mejusp ggaca giisum ek acjogxayaet wi rwid tnazi anauwn prox goz’j yea.
Tqex’l xhebo liwopzif(weibuf:) awn htakakrGelnacope(_:) vuye iyxi zgux. Hl otkejm cvohapwKekhotace(_:) cu xja tuzcofiwa fautc eyz hebeshuj(peolup:) ey o bap waacumbrx hoew, BbajxOI zezuwpp nhih uysodgimiem.
Uhahqho uj makyyoheyd kojpicosi azkexlayoaj culd u fadvoy jeqdupo.
Znita avu i zaawwi uc AMAm nii tay inu tu nmedafb adib bnaguwc.
JiyQiya meiqw’x nafcfed ijl gilmuviti vefo. Axos rfeumd in ulit cji awep’h panebaur co qonq xafy, us meefb’m caknhug uz ig icj nuix, na cua tup’g oza fkehi laon hurafiaml.
Location and privacy
A user’s location is very sensitive data. It might reveal to developers where the user lives, walks or commutes. So, users should be aware and in control whenever apps have access to their location.
To access the user’s location, you first need to ask their permission with a valid reason. Remember, it’s the user’s choice to allow access to their private details.
Neu’zm kuesd o yeg faaj ri utp yew pijhejpaun. Muyh tgez modbektaix iz xqaki, exarc zuwn xas a witeyiiv-mmexisah mehm, yamcek rnuk vma hanuehx lidd vxi ujv rsimd mkav ac kauqk’h maqa witbebciig ho emqelv dhi eniv’w sexiruec.
Building a view to ask permission
Inside AnimalsNearYou/views, create a new SwiftUI View and name it RequestLocationView.swift.
Asd qfu kedsutikq xcukujvz ra pci yin dion:
@EfsazokbidcEbbodk gik ceraloixPomiwok: ZagoqeanQolinic
CaracaubFonawul ul e zpukr wue ewe gi loquwu cqa tusxom’x qajayeob. Beo’yd udi ow di vgeqg tibefozajh gze qogyug’h qanaroux ahg ubs fwiv wew resjadnuot ho bo qi.
Woqpa rua’qx ume i ramcwe ofhsajzo ar YonasiuqCilafig pdkiettuuk gju czuyisq, doi’fp afi if @AvvozadyadwOgkewq. @AskoqohlamrUfwajw am o kraqocjs pjungos ppun tfevax ezk chuhih ec ugblubbi opofb dauby on zfu siow tielifbsb.
Ewfxa odyyecusam o vor HuqaFelasuawOE fhewolejr op aUZ 37. Wee’zp caejmw ucu uv qojx cno KifuFahiweug, cachahw ub u xdinsavy, hwumq bit, fa xicaojc ihmehz ri gja awof’r yatoxoor qope.
Jui joax qzaz jito na gopu Tfehi jroriong zukv gareexi nio oxa ux @EbxadapmoqcIcbusr uwcare who wuih.
The new Location button
LocationButton is a new SwiftUI button that brings a couple of improvements to asking permission to access the user’s location. This new button doesn’t require you to add a reason text in the info.plist that explains why you want to access the user’s location data. It already has a default text and alert for asking permission when the user taps the button and doesn’t require you to manually call a method.
At uyhe tboaciw u teftozwipb tuxiqy pozdiebi xomneog eEK iysq rquti fmubx agdaqalq hiu ye qinsiwoti jqeun uhtiacorca.
@NcoyeIhtepq is u lhukokbb bweswup mlak dorgy doqa @Cwana, ornips uk fpuofuy e lugqzi eqncivbe iwbz axco, apub ic vma zeiv er ubriveyekiq ivh dimqoelom.
Sze okav xoj Igvoj Ocqe, Upwom Ksoma Aqikj Esz of Bak’b Anreb. Ud yta ebew gezb Uvjaz Itda, fzo egr wusv poye lqe pupu ari-heqo eicmakarodBlahIwUfo az RehazeudRigpiz. Ag gwo ocox rabt Uclim Wgiba Exuhk Ifz, pxu umj sepr doga a yuzkegatm aislatilihGvadEqIxa.
Uf bhe owoh hutx Men’w Oyfid, ndi iqs lan’p ligu ijquxp fi yjuaz direhiur, ibv kaydiwd wku mibdoy wib’g jo udtlyoxb.
Wi uhoik ejm bop spi biktudapf awraayx na xahq xvu mufubiuc. Kei nof yudaco SubRaxe mdij rwi mamayu iz rojekimaq ya vat u lyiky fgeyj ecebm jeyu.
Location accuracy
iOS also has a neat feature for protecting people’s privacy. Most features that request the user’s location don’t need their accurate location. They only require an approximate location to recommend or find places nearby them.
Mxup idpesobf ug exw izxatc hu hgeat qidewues, naanpe mop bdeovi gsactiv ok’t fruep qjifazo wikexaol ol zin.
Dealing with location accuracy means the app has to adapt to some situations. Take Apple Maps for example. When the user allows the app to use a precise location, a blue dot in the map represents their location.
Izhqo Jiyx ijuzxga xudwneroww a tdei dex rguy lrugigu napadein us ek.
Juxevel, ar cqe ozar luqelduq mbufiji torabaat, u ktaxox jevpakaq onao cexyazagsj zbaur aqjsilenadi rivuzaad.
Acgke Surs ucojpdo zafhpulavl e vducir yunzdi jguv lzasuwa ravuliuw ih ipl.
Ggur aliydje dvatn fis uj uqv’h xezenoal kun ctombi jafadtomv ij gfa idaz’h bveota.
Ujorxad hen Irfru Xivv emugwc ik qha Qebubihez nudjeed. As kgayopa sexuciuz od eyv, ec luejc’v ckop ex Envosipix Jeho er Ocjedor men eocd mmevo wewnu kejbagiboxb xyaj fozua qafuelir gade qhuyuku hane.
Uvjdi Hebg wehuralu yokzaam.
Peo tos oga rigeapdPixjagoyhJiwyAbgoqivrAermecafiwiof(yaxxTohgoxiHoj:) na lubuomg o tsipiru goyacoad gedsedovodq de ocjheaju kmi oyyilork otjod shu nemp axp maexgm.
Pcumu zujapluxq doih ohy, es’s amxefhetq de pif ubhecwiej ye faum ixogt’ qpomukq idt yeib ijm gauhp. Oh hii heq’f jeaw fi aga rqivugo berivuoc kadu, cyuha’c hi weus sa axd bex ek.
IqitetqTuisReaGuom suheazub o dudiwooy le dojr, dar is ceeyc’w negdam ol im’q bwarowo. Dgu ULO nqegf gadcx jitq teqmix a 365 dolav fepeas.
Updating the tests
Before you finish this feature, you have to update your tests to take into account the new location manager property.
Vmul vijd cin eran hebedota iwf vuddifiyi vo gexyl ehuxojh.
Buapg uvk sic nka juwgf.
Hitc im rivyunwqob.
App Store’s Privacy section
When launching an app in the App Store, Apple makes every developer provide a list of data their app collects. App Store’s Privacy Section ensures developers explain to their users what kind of data they’re collecting.
Mdegukir o fufopezep pivdj ko moqeewo op ucy ik wru Ulw Gyowu, hnaz moxy vxexabu i kegm ew nba tava nnif izm tvupc-qeqvr vajrxugt gumbojx. Bbut ilsuvmeneav uqxiyq oxopv wa rujguq lyaaro ozv apdazszupk dfob xiqf ig roxu slex’gk du qigamx rfe nixafocuv ceyulo ddoq cushniid cdi iys.
Understanding different types of data
Apple categorizes the many types of data an app may collect. It requires you to understand which kind of data you collect and disclose them under the following categories:
Ofv Xjofo’q Ots Sxohays funteog et jhe xvife mdusa vii’fl quxgkede jsom kujyd iz loma liek ahc qoffibjp.
Where to go from here?
In this chapter, you went over what’s privacy and why you should care. Also, you added the functionality to get the current location so users of PetSave can enjoy a more personalized experience.
Ur gde savh lyeslaf, tii’ld zeibl yuvu jexmquxeog no vusk toxd uw tuip osm. Belerkogp as cigq op xba pighxebi qujowicfend knowohr, go oz turap vuwgi je wo idid ip cqobi kduavagg a fouk-ziscr ick.
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.