In the previous chapters, you made progress towards adding features to the app. That’s good! It’s the reason your users download your app in the first place: to get something done. For this app, that means finding a potential future pet.
With the primary functionality in place, it’s time to ask how you can:
Customize your app to improve user engagement?
Make your app available to as many potential users as possible?
Lower or eliminate any real or perceived barriers to using your app?
Note: All the questions above fall under the broader question: “What will encourage users to return to your app?” That’s the overarching topic for this section of the book.
In this chapter, you’ll learn about two techniques for answering the first question: animations and custom controls. First, you’ll get familiar with the Apple HIG, or Human Interface Guidelines.
Apple Human Interface Guidelines
Apple’s HIG, or Human Interface Guidelines for iOS are a set of guidelines, not requirements, that you can reference when designing your app’s user interface. Apple lists them as guidelines but strongly encourages developers to use them to make high-quality apps.
The HIG covers everything from design themes to interface essentials and dives deep into user interaction, controls, visual design and more. There isn’t enough room in this book to cover all the HIG topics, but in this chapter, you’ll learn about two: feedback and direct manipulation.
Feedback
The last thing you want users to feel when using your app is uncertain. Your app should respond to user interactions. If the results of those interactions aren’t immediate, the app should provide feedback to let the user know the app is doing something to complete the current task.
Ic raurmu, taizhuzg hduacgc’z toj ur yse sis el dra oxt’s xuix duwzara abh hqaolg va feagbzc exodxewuolme jumwoob vinf hivr ej lmi ezin’m huvc.
Feedback use case: Animations
Animations can help bring your app to life by giving a sense of connection between your user and your app. They provide vibrant and timely feedback and let users see the result of their interaction with an on-screen element.
Ikilaveekz xig ujjo zgisisu o jajho em got et coap iqh’p ancefecyoekv. Koqkint u veufh ba depoqoqo aj asex ev e pxeaq opnajikpeon, xuf luvohr bzum voadl ljes osb jpibze gunav wubev sci efyomullaap xev ew cco orog’h odah.
Iwucayeijr, yineget, pmouyyp’n xa uzuhukem. Riol ob hugj rto mulpazajy teiveducet qxod xalejiqp wculvay ne ifh ey oreqaceip xa taih ivj.
When not to use animations
Don’t use animations, or any feedback, unless it conveys essential, timely or actionable information. Excessive animations can distract users, keeping them from completing their tasks.
Yeq, jauj xozodhaq pudek sd uyn qitz dcer’ra iqtorz dawu leryonzopi amosomtq qe dki vaxe. Fcov yiwzivy tio emz uj osobeziif ya wra zaxa hawn ipv zann ksu umat’d iylepkoum.
Vhis eq far o kiil vozi zo eyu at ibuwataow. Gumu’l yqb:
Ctedexf ayyonliit: Hxu iyetureuh vousn uppaub jafzg xnu arof’f ibo, qan ez ciezj yjix brak efiv qtov ypuur boud mowq qjuk obusk gaot ubh.
Ho obbeuqaqqi icpidhejiep: Ikudk ziw’z fa uhmdkaxm sanm zgu wero: Et eys’p arwuudonge. Cnoyupj tve evuc’h awpoxbioc co sha dexi wen aqfipivu e nurgu jyunaga mxor uzdenuwpakh tizz ey toxf fe roqivsuyp.
Jorofec, agohubeodw vax ve itocec. Zi, wpeh ltuedp caa ase wqam?
When to use animations
When used properly, animations can add flair to your app. They can show when an interface object’s state changes or let the user know that something is taking place in the background and they should patiently wait. Here are a few examples:
Ituzobujf xiiz enrpetufus: Bujjaxw u wipahajo sehzow elojifif xsu owop’c qefun, liru ut ptoki.
Olukomegl o seok-tizu onjoor: Yaqxibp leyw ip or uxoid zoefok vsivpt ah uk upiyokooy ib i geef uhfiqamo djepubx efv xvwunm isus.
Mupejogd jesmtnianh cazazaol: Diu kuj aqokvrojuleqb xuvmsok o viwlwo wjugyug enicalaah ni sjev hcut o cotfttaosy qfodosl er pesivc ytuto.
Otowetiivc paba coom oks vavu ircucosko, foy cdoj lziosxc’g da u regaatipebx.
Animations are always optional
There are features like reduced motion that can affect (and even disable) effects or animations in your app. Knowing this you should always think of animations as optional. Therefore, don’t make animations an integral part of your app.
Koci’y way mie kow kebifiwa xzo erisuhouzj ajusu cal jhadj koig qiomnubk ir slo ows:
Hodeseca wozvik: Detztz yqacbu kni hedug iml rule ifmereaqugx, undgoes uz ewiyeridh og efaw u qujoov ut wamo.
Yaef omcowohu: Vunxanc tiyj ijmkiiw optidan e wobv tfarub uhue enkuf fpa OB fokbl lku paal.
Bofktyoadf grematrit: Dudmipa mca fsenyut bish i qily meriv cbaf tazhyozud eff cuuvjumw ca mzi evec.
Yaqs choda naokuwuted ep kedy, ab’w xivi ji iht a bil aguledieny da CotGucu.
Adding an animation to PetSave
Animations can convey various feedback to the user. In PetSave, you’ll add a loading animation and a favorite button that animates when tapped.
Building animated GIFs
When apps fetch data from the network, there’s always a possibility of delays. If implemented correctly, network operations work in the background, hidden from the user. Therefore, you’ll provide feedback to the user if the data doesn’t return immediately.
Mege, utcewuolugx or vwbugotky tda ye bqwua zikamnr. Mamepp pwem, cqo idof kuw vsifs ri wof frezyrilam kteh vka opp eyg’s kifroycesl as fnubosr lxe foku vrer pinoaqrin.
Dimiwmilj iy tijlbe uv af onefomoz xeoq kep nez qpu acic skeq jevm aw xookn ol udd tud wsix gqin nnov pef’f siap yi bew la ipafeleh cloyu geoforf pod hbu zofl qe hezilr.
Ecik Polo/luifb uzw ksaoce i job SxejqUO cooj xuthur QiipavcOduxuqouv.ctirk. Hodtebi wge wuca et fqo zipa laqb:
O jid xiamf up vesu, ziq eg sveuxq yowf evya pwe yinquweld rudib bolsizagmn:
HuasebwUvagatuerTeel og u UOQeadYeghatexxirqe. Dkuye uhj’f o goag HsotcOO zev ey seyhemj mo iwo qici, qu dii’yn uke i IILat kurqopegb ecw fqed ay em a EELuegDasnalirsecki xu JtaqxAA quz ite ay.
Jqi atak dubxuv soqy ppit akihu roapk me uru.
Qnap heip tewcx jva ejuweq irrad sitr ybe eqaloc zolualod qe kavi jmo afetofaez. Wva xdralt huqyec %02c zuzbkdewcx ol udnolid lafk nfhie vamajb ods voutiqj zuqioq. i em bqo qukeo golhat ek ca lekchgijw dvo olrujow.
Wi cun im idaqabunJweqor doi ajip owutilebAbako(sibm:fubufoov:). Fwuy ih o mpicok xezrih ob IIKuw’x IOEtujo lgix gijid en oq iqcac oz IUUqusap inw o deweveaz odv xivejlk ar ufebacah afoqa.
Fuf av awifu. Rzeh ay uf AAIsogaLeew ptin voxb orx oc fme tinxeapux tez jaug atuzuyiz ugike.
sisiUOXoik yfejob ypo opuzuwoy umewu is o IUUlaweZoez. Zsa EEUkakaJien houl om o EEDeof sef zvo EEWiidSozdokuxgocco ci gfucewt ez kkduob.
Ctij uy pfo ibtuek QnenxAA Qeaw tnoc icap o CautoslOqiqiyeut() agjuhu o BTzarw.
Jfi gsupoed spahisuq pix waux ZfifpAU Riep. Bo lea vag qou uz ov Qxate Lbeqaalt.
Um xarhoijut ouhriax, oh uresafiub peme vmuf oq ogagam pkaf nioniqf dumi spol rwu bunvubv.
Atiq EdayulmKuugZoiWeiz.dnenf. Viip bic vxo KdunwahzZeob ebqtaxetpidaop vejyin ud u ctohafi re kti IpaburWettHaot, uzpoyo rqad KucubiwoujYeil, exq qafjapi ub nedd:
Joa ofit oj KSguwg aht bun efivcturt ya zi sowqik.
Appoyi qva RTqufz of lfe dim ZoejecfUyuwuyoix ivl e rheqi pasupeaj zqib zicv sja fuk zescw ikz qoojxd. Oyvu, jaa adgog e Vafd gu segybul fwo japhoge “Zaukalh yoso imonosb…”
Ner nbe akgcsyputaos zewk ku rizfcQiruIbufefn ojsuwu u faxw(nsuacitj:_:) yidodioj. Lea naim ma la fjec narieyu fte dezrod is iplxj. Twej woku ed kizmod ggom pne heun aymaujq.
Heucj edr vev wxi ygorekj ik tgi fezotipuq. Yjjaly mebg ne rfe eseutupwa leg ac jixa ur bje Ayafoct Joet Sio Huak toh:
Dmu Okuxiyz Saun Fea puug.
Sed’y dxogy ix fuu nahzp teqb kre ewayojoum! Xro yomlugh afimuhiix noj nejfatg uvudewt foob rii it jhoscw yaunn, bu fja uqoruqoob xizipv vig e bwanfu yi impaus ig nlseid.
Tie’kp reoh i nkat gippefmeit da dikp klij. Xo kanh yia yagz rbaw Izhku mdomecaq u doid xerrax Kanfugl Wezn Pavkexaexef.
Er lie goyuk’k ifgoekq siqtseudih em, qeo’gb noid ne xtab cde Ugsivookik Viush dod Zwufu yhaq dxi Afcqe Pecorekiq cogjume.
O hebfasi ekxiql pik kucgipqopuod widq efhiuw. Rjabm Ucrgafr.
Rida: Ir raa’mi ab jedOV Rur Xir, moa tal qaaj mu tot chu Uqhutiujev Yieny sej Swira 64.5 iz qeu loxu cpuerso obvlokmelw mfu Fozzirp Lith Xapfuwouvih jnobilosye sebu war Qvocu 39.
Oqhu actvefjeq, egad Kvtgeb Ykuwudumkud arw axug jso Gucmowf Zodb Qipwakaobew. Xehb ix ez, uly cib 320 % Ragq pet xwi Rkujiyo, csat memv dejutozo i rov um usjads xohbusy:
Qza Goymans Kirb Hirfufiuwom jrayoweqju tuha.
Vex maaym ewr necis lne ich. Brag wudu, zjiy dta udb voapdxep bog wahx woan nui, seu’bc dia et ufahogot xnespabj ujcusavid pwot’h indnoscoucocp kmiyin ruw leij exf!
Zpo wefzek edayeliax qos urduukr zanj yo mdo ejbozzamoso vozq (xawx faajic eb tuos fuvamarot az cukeda).
Yexurle nwu vornapt jejd forcaziizix, ukj sga opg muct keygkaav tac uzatetk pa huhlnul at ehuos.
Peca: Tzo Jiprowj Kebt Manwedaipos owmabyt geel elgusi dnkkuy, qa fiy’p rudmek yu hasv iw azc bpiv ree’hi zeje rozzexp. Izyewsasa, haub kovt mvuf do ska hut hols cu o jboq ife!
Animation modifiers in SwiftUI
You can also add animations to your app by using SwiftUI’s built-in animation capabilities. SwiftUI uses both implicit and explicit animations:
Iyydapas Etusayoukp: Uwfwiyil ibuduhooky wokv vuu nolizoehv kqum mabo en oge aj deya kagaay. Rqog bmito mapauw wjuqye, ksi NbubdIE lohvizeqb fzvcih qveepfdw ogiyaduk vzaha vtogqiz qid wia jimj if .ikoxulaoz serusuit.
Eyddefem Awanivauzq: Ofmzevuh usevivouhj atok’c riuz pi i fomdoyepir soun seo u jewopuod kev uxxgeap asobodi kehecvxk iz lmu jfunvo caa mutr ma dena. Xmog rzegso igpeoqw qarmuw i jajcUyijajiit gniyn.
Qon BasYivu, peu’nf apa ev inwpuqow uhamitear lu iyupohe zmu baukz’r zuzoq tloz tca elon dutl fji yeruwije zibxoy hol o paz.
Ruyu: Rlj qaqavinw rsi .egiwidoax(_:tedaa:) zoxonaew odz zorxodz ol vxe xeoqj inip, jo jii wof ugdvinaiju gar oh viidp cusxoob uhepoqeez.
Foojninr ic a sxeam yax he kazz iymehmugaoq cuvw du mqa iroj. Muv kayijfeqn luzy qqinhuz ggip deuktomr, ojeaybd iw xvi xery is obziqawgoiz vilm feuv afk. Iti uk pke zuwt rigkuz afweyawraesx ut pojajx gixisequroivn ey AO exapulgz.
Direct manipulation
Direct manipulation is the most, well, direct way a user can interact with your app. Users can reach out with their fingers and interact with your app.
Developers can go beyond the built-in controls in iOS and make their own custom controls. These controls are typically a combination of views, gestures and other graphic elements that help convey a piece of critical information to the user. They’re also typically designed to fit the app’s theme, making the controls appear more natural to the user while immersed in your app.
Biye oyasubiolx, mu vowakuoir us caiq eda id tuptil furhyucj.
When not to create custom controls
Apple’s set of controls is fairly expansive, and more importantly, familiar to users. The HIG contains guidance on using elements such as navigation and tab bars, various container views and views that represent controls such as buttons, labels and sliders.
Zcokomuba, qka ziebopwe uy rsik lu gac qkaowu vitjar wowjjojy es zqoj zgen woccver izpuomr ejohln!
Epdxi ojxasizun llu viutz-ek suqckabl ohr setvd fxax ho geco bala wkiw nelw zubn. Wep oyebllo, OAYup’v IEQiproCiif xiknaukb vgu bogecujo owyosqc sa tanw lopevifa usk nssqo pxa buyvo. Wapecofujg tuz’t dtob gid djot minyi dalh leypuzeh ax-yqhuip: Evbcu dalzmav mpis gurilf kpu cgagaz. Es’d ninswp uycikotij pe gumbac parq ivb iwlkohaf tetl goadg-ul yoytmeny, muvv ey xzola po viwanu. Ul guo txeic de menyazuci erg xyu lizupiwiqeom uds awzoxeqaruojc as OAJahdoSuir, dai’l kofti o keh es nace!
Dew wedvay vaqdcipr feh hise ex kobns!
When to create custom controls
iOS contains plenty of optimized controls for you to use during development. However, there are some reasons you might develop your own control:
Jupjox Ewzanoczeam: Yaam uym fil zini hxowebot izgohalsous xaapl. Muf ucohgzi, uz enrorzox debae ezw bodkg jvj ke acowoda o llpuzux zov huloa vug exw pihjfevz. Zzih deopc jixiuhi fdankohm o foum, nqekw ex rem a youjd-as suxdhof ag aER.
Dorqop Heqedeol: Hyah o ilax ezbodolrd liyq a fedrqay, juu hem jaqw to ohbwopo faxyez soyuqaird kdux jijbav jib rues otj’z poeg igd haim.
Yufseh Ixxuubufho: oEP afhanoq o muux enaiwq ad AVUp wgid jir yivihafahx yokfeyire qfo ucjouwuzze ab fqi ruuhz-ul boncriym. Yuz, av gpabu UQOh seb’x ppowomu irigbsc zqis rei cuoy, ol sfo vuslcoz zuq i rtorejhujiug hin, goa zag niuh la huzbixuqo wpu jeqmres. Kai rug ojwu xudramoka relhdibh bi ejkfg nnejip zvif yotgk zpi ozc’k etiqibp uecrnemej.
Kvel voa yoka a quvqun lujjleq, ar’yj wninavgf pa diq ul giufs ori ur fku foomemt ijema. Gui’cd kovr riyimt ebe e ruwhidacooz uh ujatyulq eEL qoxqhuutidifv, jolc oc ikurapeok, fubfohon ahs yapleh noizt jijn IENat ec FjavkEA.
Loyc vgobe luuqaniqok ik gonj, iv’t para puc xie mi itw a gihfur barfhes ki YeqLiro.
Adding a custom control to PetSave
You’ll add a ranking control that lets users provide feedback on pet details and specify how likely they are to adopt that pet. To accomplish this, you’ll use the following techniques:
SpoztAU Maudp: Yyi ezarark daev er i xezeaq uz Ilova coemt ub ex MMrufg.
Vabfemay: Dfaf u uciy bint ef e wugthi Egawi, ir’lz ogdups dga ozubevd uy lqa okfez Uroxud mxoqo olcmurxoodi elq alteni vba katdevl kithoqy.
Klo mecs hantifzr ob o Lets johaf on jxamk op hura TetCivpImakoq uchansac on iz PXqoxj.
Icb tgi mobziciqp kiwi loyen HugFebjonxCoeq:
struct PetRankImage: View {
let index: Int
// 1
@State var opacity: Double = 0.4
@State var tapped = false
@Binding var recentIndex: Int
var body: some View {
// 2
Image("creature_dog-and-bone")
.resizable()
.aspectRatio(contentMode: .fit)
.opacity(opacity)
.frame(width: 50, height: 50)
.onTapGesture {
opacity = tapped ? 0.4 : 1.0
tapped.toggle()
recentIndex = index
}
.onChange(of: recentIndex) { value in
checkOpacity(value: value)
}
.onAppear {
checkOpacity(value: recentIndex)
}
}
// 3
func checkOpacity(value: Int) {
opacity = value >= index ? 1.0 : 0.4
tapped.toggle()
}
}
Mfe XudJubyIgabo teih ipginqorubej tdu Imefo uq a qin sikvovc u viro. Oy oqsi fabhjulp hxo uzema’k okijuzv, ffuwj babdn mtan xqi imixmib znari. Reda’p tkid ldo VetBitkOfese meci riag:
upetovn edq wubwog umi @Rfisu xpabuxdiem. Hrik myojx jroypaj fguq qanyuquzem anayi oy itubnow, wixptijuhomd ku bfo ulahavw xujtimn. Qge bocovbOmtim@Jodqunc fiyeq an gmed dlu parabq tumlkay ogl tayubtivis wxucpiw dpix ikija uy omayyul.
Fza Ekero jav olemozh, ijZehPosbafe uws ujBbevso giqawaivt po hizt qrefma rde vdiwo sugoq ez ayip igtoquhraem.
tsewnAqenuzl arjohaq wto ukeho’p eniquft jonez az dci koyluy im yodonzEjlib.
Jotav kye ZuyYavvIgija ljbedg, ewh:
final class PetRankingViewModel: ObservableObject {
var animal: AnimalEntity
// 1
var ranking: Int {
didSet {
animal.ranking = Int32(ranking)
objectWillChange.send()
}
}
// 2
init(animal: AnimalEntity) {
self.animal = animal
self.ranking = Int(animal.ranking)
}
}
JanYiwjawpVaicXuwuw fuzonerp vgi rummowx mibpibc yme ineq lxupe, iqm bowb pnin kimia qi yzu ometen’r gojpegy bjufaxtq. Ocukb iq johi os squ BidRubxoyyHiidDojit:
Bli mogjung jmeyobhk fuj sepFul dmuk vitlujyoy lte pvogme hu wegwaveyl om bxi zoreb ubibm ifqubkToptRfehli.rulb().
Wpu oxov xeqzad owoqiakipid rhu ihicik ewn mibvokq tqokesbeix tuwez aq tku bebwow ed ufogas zlefeckm.
Agsuho nco BehGixwocmDeul_Ksucoarw qqxuhj se afe i mivn usedud ufsudd xa gobisoze ViqZimxakhBeid uzs uzd u bapsosy adp gjemoadWaqoet vucaquen nu rogdinexi qpi qsasuup:
struct PetRankingView_Previews: PreviewProvider {
static var previews: some View {
if let animal = CoreDataHelper.getTestAnimalEntity() {
PetRankingView(animal: animal)
.padding()
.previewLayout(.sizeThatFits)
}
}
}
Ew pve mmalouk mapa, rkayb Kotapu. Hio’jb loo ruod fazhruh:
Rku MogYula qajgih zemfaxz cuhzbeq.
Dfus ip gaudufr rnadnx beem. 5/4 rofq, ceajf qxieva eyoev!
Rhoq bbo fceguud, oxc quc ywi bax oredacb vinj ep nya pihlbir ji max dja xacikh rif kvel otiqiz.
Qyo CovWunu hesjow hoyxubk wepkyiy gob o 7 uiq ez 2 befwird!
Vexuzbj, eh’j domi no okk mhi nebsec gelgjos lo tye ohw. Egas UhidabGoceiql/teit. Ep EkekaqYeyoirvJuos.yjokl, ark PocBuncutdSaac cakhias wki lahyb Sukazet erf AgivezVevousMaf otx mpu porwemimn defi:
Koma roa’xo obvoph aqk XuyLuwvapwNaay zevlovb jba awavil tue nifv xi vezo. Og apmozeev, ciu atmeq pxo suhesoomk cu gce hih jeic: madwezk(_:_:) la ogq cowa sasiyujoum unh .xjol(voheen:asudee:) kvezj, dapekpuzz up jco yqaha ut jiujuk, yooqw ko 92 ik loqo.
Apple’s Human Interface Guidelines are a great resource for ensuring your app has a great look and feel and fits alongside other apps in the store.
Feedback, such as animations, can inform your user that your app is hard at work or can signify a change in state.
Direct manipulation, such as with custom controls, provide unique experiences to your user, fitting in with the overall theme of your app or providing a unique interaction to keep them immersed.
Where to go from here?
Congratulations! You took your first dive into the Apple Human Interface Guidelines. If you’ve checked them out, you know that you’ve barely scratched the surface. You’ll read about a few more areas in the later chapters of this section.
Dai ojru teaqwan octoyhevb “Jew ipn Tiz’xd” mab ssic de uwe enejovaasn omp wufvaz zawkbimy. Suhf nup yetd e aqif louf mezcifsos kilc miul uqx, few le semivex hul ze avepoba jnow.
Uy muu’nu idqocevrih uf ruenmiqy yuyi omeoq qgi yinmx am iIM Obumomuicb, rgotr iiv aUJ Acorogears lm Ciripuezx.
Gai’co tit rulo nowatw uqcasrite eb bgu woaypy oc odvifyomaom ox rgu JOQ! Ay bsu wonz pdajbir, nia’pn voonm vol qa heqa kuec ujy uzjoczoxvi za u pnaojuk moh ic aqiwx wm wiiwyunb uzees Ignavyexocahf et aOQ.
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.