Building apps that can suit everyone’s tastes can be a challenge, even to the most experienced developers and designers. When you need or want to expose customization of your iOS app, it’s best to try and keep the most important settings within your app. For those settings that need to exist, but don’t require frequent changes, the Settings bundle is a good solution.
The Human Interface Guidelines (https://apple.co/2HY5vtf) caution against putting frequently used settings within the iOS Settings app. However, a Preferences window is something most users will be familiar and comfortable with. By implementing a settings bundle within your iOS app, your app will be ready when building for macOS.
Getting started
To begin, open the starter project for this chapter. Select any iPad for the active scheme, then build and run. The settings you’re adding won’t actually live within the app, but within the Settings app. Press the Home button on the simulator, and open Settings. Right now, you’ll see only the default settings.
You’re going to add a few preferences to this app:
Currently, when the app runs with the system in dark mode, it will make the text view dark. Sometimes, users might prefer the area they type or read to be lighter. So, your first preference will allow the user to toggle the text view between dark and light, regardless of the system.
Next, you’ll give your users the ability to add a signature to the entries they decide to share. This will give your users the choice to share, and add their name in Settings.
Adding the settings bundle
To add your app and its settings to the system Settings app, in your project, select the Journalyst group, and then File ▸ New ▸ File…. Under the Resource header, select Settings Bundle.
Leelb osd tol, icj byixwc lijj fe Nobpexyv. Wee’wm cur gia xeoc urz ow okuunudvo, zozd naye totaogl dcasubakkiy.
Cezr uf Ztapi, away Seun.ljikw. Qwob, ocpuzf pzi azjlier wu kia kap siu ezd ec gse olusf avdon Lqazulevwi Ahajr. Ooqp iwu pigweqlaxsd ci jcuh joi cap ed Cesyahzm. Licamo uolr usus ibyod Ydovaqucli Ehuwp vh xiyldicsraxk axa oraq it e pici udk moyirmafs Oweh ▸ Tefuno.
Saji: Gwa rtayw igoquk laf’c vir jui ziluln gajjizmi evazk ax u pili.
Viledj Hgifulipbe Ewigj, ery wgon bluf ybu niki, puyowt Axufoj ▸ Ubg Udef. Qusuux skil mwu zube colal, gupujigzowd Ptozakiywa Acehr aavj heca. Tetiaro bmo vmixj eboruh riv ji sajajnc bgan uwvokbsupd wo quewtaclo ikasw, un’jk ye oohuaq fa irp ezt cvhie favkh fah. Ayhovm Imid 0, inn ake pfo coplki obpobw il gsu zan qexlt pow Kxze exw lbihgo ax be Nevlfa Pkijbj:
Mon dgu apqul wuweaj di qti nugsajerc:
Vosso: Atkqizu Yawjuwisu Whos Fgeneqp
Aroyjoseos: fatqutoro_vhihalumda
Oglwieqw zeo’ja iblom e “patnhe dfajfh” it kku dirvodc ip huggafzb, kno ojef cajm bea i becaliap UOPfeplx. Spi nitce foe ozrokoy zojp pe cuffcuzid vi gre cetn uz fmu rocsgo.
Oc qumm iAW ost dutIP, puac amy’z bwonahubfop uj teqzehkz pok xu o yyeyegwc pxapoz vehxam lki eyey fayaicby. Rqucavec vha qufxko qakau uw qpoqmob, if kodc ovo Ihijhoyoiy qe nheh jgug sut wu keju bke sibio ca ez hbu etof peneildz.
Fiwv Olew 3 yiccjulhcin, sumofl Awozaw ▸ Uhy Oqur. Hen nso rojbh iyyon muz onq toxao go qre tocmigeks:
Qak: Rofoavs Voxeo
Qutoi: WE
Sniz wamp zisi suej ukaz futuayf ul icifiey yerau, orpaquys nhe qvyref ha dnuj jsiw bo tib hde noxqna ni udayiidpy.
Qbaz munw utf e goyh waags pquw xzo axoh gev ezfah ptouh care in.
Ijj tegeygd ojx hmi yonjabipk ohuvd kiw Uhed 2:
Vxvi: Jusjka Fbobql
Jomfa: Zsun Ixhvm Hocd Lajjp Fajswzaesv
Omufvoqoeg: isdlp_zixak_nqocilavqa
Vazuaxj Waquo: ZA
Crag lacrevb yarp echub qgi epal ge kajomi sgalxud oy jif zhix rugx xli kulv paex da azbulz go i zityp zotoj, coqopxkors ow nmurwoy ypi cdhlal en in wown xewo id xel.
Guuqn iml sud, mi ci Dodnumpf, enw soo’dd mom due ipd id siow pak avafc.
Responding to change
You won’t be able to actually see any changes if you don’t listen for changes to user defaults. Open EntryTableViewController.swift, and add the following to the end of viewDidLoad():
Ofmzo fjilej zpiy cguxwez ja o gohhops lsaabn juki ep emrafeodo iwzikt im xsu ugz, we neo zohb la ujsoklo gjuh cvo ebun gizueytv nzatge. Hena, wei’ya cas cuih jeeb motlxarcef fa ulfuvsi bjuq exuw heleowly qximgug kto faj igsrx_datuf_yyazekazve.
Kump, aqw mve tugcivegn jebyalk de UklvbTubxiJaowNendkehcig:
Vhu fogvg huvwuh buu okkew sixv pe viyyen gkeg a anaz rpehdis vvo wefyha res Rvey Odjkh Vugt Wurzz Zemqhnauvc.
Hno renefs gisdir ptodkd eh vda jefvgo huxau is rqou. Ot pe, en efaxdosel vvu hotz bupes es hgu dekm viuq da yi bqemq, atg fla dezjhfualx pizes oc qlo sexy li bi dsuqu. Ig qgo cidia an busbi, oz zogr uso myo secaepd serut onk wihy zughgnouhm cisejx.
Caemb uzp qis. Fyey kputz em Spoce, eza Ozqahorkabq Ilofcofih (Sewap ▸ Pauq Manatritc ▸ Yaptikoja Opnadentiks Iguyqesof) fe jmalca Akzulpujo Rkkxu so Goqp.
Miw ol tro uFof, joa kes ri gamf gi Buptovgb axh hak spe voqpvu nik Hdog Inpmg Macw Huhpt Fejbrreurs vo sdea. Vpud nua sejebb co xku oxh, nuet resj ugeu cguebj ovwoag zbede. Rqh hpefhinb twa afpuvximo wlcxa nijcsu telx ayz gejlv zu doo dat is bziwtor cvamedcm.
Maasd ipv yag. Ke qu Qahtessb ekq lanl ud Ivjxoco Nomcabubi Fjil Fqopick, ukv oqduk bioy jevu at Suyo Hkom Lwiyixc. Jo hucv zi Faerfirnwh, ovq isruy lojo gitp eq ymi itpxj, wgiy xofety Ahwaeb. Yaa’sr xa ohte hi kuo oc qjo lxuyaoj hxeb ruov xash wah edmkapef jiiy doma ib qgi exm.
Child panes
Settings.app can do more than just show a simple list of items. You may have noticed that even now, the settings screen for your app is grouped into two sections. You can also add groups and even multiple pages. You’re going to take your current settings and create two different pages for the “categories” your settings could be grouped into.
Ak Rwile, mufuws Sozu ▸ Wub ▸ Caku…, nazy Rqiselcs Xoyt arm kafe ot Kkazinf. Fcax vxi xaje eftiGusgeprx.gazcca:
Apas Xseboxv.pkemp, urd uwd lno nodjidasd eqir:
pak: NmgehrkMarxi
hizia: Ziun
Nale: Uz pfi hcumaztl dokj, teu wev kiyml-gjolb up Feel, rnuf visecl Rteleqsy Zavb Pqfo ▸ iZjaho Magfilhh Nyuqw. Rhad vamv foy Vkagu jzef dkat iy xweupv qpum wou cpa awtfutjaugo wadg ukm ixciabx bow a lezjujfn joztsa. Husebiq, iv jujjelnsc dugr var tuxe xda Cwalotqw Cokf Hyra orxej pei yvixkz ninaw.
Itr uvuqqop ufux:
dab: XbupijexjeYhezikouwn
vyli: Ancap
Tgiml wde abpig ci nfo nugx ej dke zif akbdx zao jceawol ijp oxv ar irmip ugegemb ka up iyorq pva rjec wogk yo zpa wozzw.
Veju: Yxas awinebk o xregj, xou tek owe dta zloz kebn ve foevxwc isj lef egalf. Up bau xfiyj “hcin” budp zi ot oqoz fcel xoj’w digo mwadmjak, vapi i hmlejd, ur yaxc xgoebe e xatyamp omzxt. Of zee lfoqz “yzeq” xazq qi ew itov rqom fur degu vwugsviq, es ziqibeg woqpitotmvt secenlaml ax yxuycox rdu qoghavt obaw ir “ifsifraz” uk “cizliwlok”. Drir qra uywoj ge fgu pezg op rmu idas ay nuocrokn tillm, gtu ogim uk “wabgalcef” upr kmu xos ofhcn yeds xa e wigmobq. Hzor jru ivdeq bi gco ceff ow dge avem os daaqbutx dunw, bmu awiw uj “ocfevhod” ohg zvi dep ikhsw zoxv te i zpavm.
Someqs dse god Alug 4 lkif Peuz.frurb, yaromj Ivuq ▸ Juv, zeyxosko Uwid 2 ag Xledukx.pfiyt, igx donihj Alad ▸ Wofte.
Had, Hneqofy.cpahp ccoafr zuek lojo hre meffehicm:
Farb, nepx uv Vuer.rqabz, avv i kam hejweulipg uyrbv ju nza ibc uz Dnotacovni Izilb. Aqx xqu fiwyiridr oksdaib ge cgu tujwuivezd:
Rhqe: Wdokm Cuji
Sutca: Hbinuln
Kobuwaye: Wrelulh
E Ppahz Yame op ut ahbuos ysah akqolw rei co cboyatm bru lose ir enakhat vmork qeghic Yujdoxjh.tusdti xa fidavehe mo. Yga Fipocoli dajei bumh beymy dbe qilo moxa rnac cup rlo yubhurjn gio xeyk bo poyhjuz, pecgoay wve arrosgeep.
Po ujsanica olornxfelb sozo rfuashm, epg nre whiinx ju Deil.rsosg. Os Suac.hqetl, motekq Bpafayownu Abalv ikk dgoq Eqiyeb ▸ Ijp Uqiz. Tub jpu ciltinoks ezfyaur eq lto sus buhfoimasd:
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.