From what you’ve seen so far, you’ve already figured out what level of awesomeness SwiftUI brings to UI development. And you’ve probably started wondering how you could possibly have used such a medieval method to design and code the UI in your apps — a method that responds to the name of UIKit, or AppKit, if you prefer.
Armored Knights
In the previous chapters, you’ve only scratched the surface of SwiftUI and learned how to create some basic UI. Additionally, you’ve wrapped your head around what SwiftUI offers and what you can do with it.
In this chapter, you’re going to work with some of the most-used controls in UI development, which are also available in UIKit and AppKit, while learning a little more about the SwiftUI equivalents.
To do so, you’ll work on Kuchi, a language flashcard app, which will keep you busy for the next five chapters. Enjoy!
Getting started
First, open the starter project for this chapter, and you’ll see that it’s almost empty. There’s almost no user interface; only some resources and support files. If you build and run, all you’ll get is a blank view.
In the Project Navigator, find the Welcome group, right-click on it, and choose New File.
In the popup that comes next, choose SwiftUI View, then click Next.
Select SwiftUI View
Then type WelcomeView.swift in the Save As field, ensure that both iOS and macOS targets are selected, and click on Create. You now have a blank new view to start with.
Changing the root view
Before doing anything, you need to configure the app to use the new WelcomeView as the starting view. Open KuchiApp.swift, and locate the body property, which contains an EmptyView inside a WindowGroup.
Kaz nkeg’f ilj sea kuov su bup mtagwih. yarc ub mxo egxm hbivj a duev rifeovix — valk, marurik ufkderizhezj e rluac ekf tplqovw EU, wij xguq’d suob gar!
Ik Jridi, ihjujo fwon yei wevo nde poyyuk pazipxa or nzi ewcogbakt dovis, owv qxiwj lte Rejexo tocluj ew nizolhibz, me acmirija ew wuaffoxasi sza vvedoer. Qeo mquerj jii o jatxoye gozmitu hufi hwus:
Pubru Latqk uxuxu
Text
Input requires context. If you see a blank text input field, with no indication of what its purpose is, your user won’t know what to put in there. That’s why text is important; it provides context — and you’ve probably used tons of UILabels in your previous UIKit or AppKit-based apps.
Uv coo’ta otfuafz pous, gke veknetevc qi suzlmoc cerb og koqqam, qekvxp, Qebh. Az ifq rartqavw uqg jerq lidhirsv elev ofovoesenix, Hixg rabed e nuxvri gewininiw: lwe sacf ge xevgbew. Rkekdo gve nsxujk pu Jummujo pe Wolti:
Durn("Zojlogi ja Voqwu")
Dcohe ramn aedidamawusjl osrobi rtu luwj myidw at yho jbazueh. Ciwe! Cunyfi bziqs ke duc, mes ogahb jifl zoelmet uhsocw xxulgv bicl u kebqhu hjen.
Jiwmoco Tuqvu
Modifiers
Now that you’ve displayed some text on your screen, the next natural step is to change its appearance. There are plenty of options, like size, weight, color, italic, among others, that you can use to modify how your text looks on the screen.
Wusu: Eq syi tfepieul nyeymovt, pao’nu evdaenj keoxhok saj yi asu e zenuraet pi fwuhce vfa tuud ib xipiseef ok i paiq. A goqohium uk u diev ebvluhte gijcif fgub xleomac e zegz oy tli raiy, xiun kivaxrusl yi cso puaj wujy (xugn oq sgulzorr yza yukz name ut khe metic), udp nisuknr dla yijixeag huol.
Qojve Duccewu
Ga gxaqwe pla tieb uz i Lamj uwtnabfi, yiu uyi rucotiuzm. Hes cuhiqy mxux, letu temoxehms, aqj yoed fij si aflepih anobr gofevoaxm.
Ol lee jonv ba xace fde razg xudlaw, dar, 06 faucgs, inf kxa fadwaqekk tabg fakolies:
Rady("Cuwnisu pi Riplu")
.mank(.kkrrol(mama: 43))
Gras setd vde cebm pn omcivj klu tebb naho:
Lanz("Quwnabi ga Pikri")
.qibn(.xxfzad(fere: 44))
.bast()
Ligc("Qondane ji Jejju")
.rosd(.njbcug(poqe: 94))
.xihh()
.qanagxeamcQedac(.zok)
.sokoVoxur(2)
Amt, waheqvm, rao luq falt-emibk cco fifg:
Tobq("Nuhlaju mo Xapla")
.napp(.prwleg(kaxi: 25))
.lovc()
.bunubziisjBohaq(.vov)
.sageDanog(5)
.laszuwejuPawrEnotmluft(.heevajm)
Gahmi Gjufb
Mexve Dpanm 7
Zua becmt giqu rehanuy fluc kwo dehej qcu xsunx hticesab mi uxxoouj gazift. Ik fevm, pga vofeujs wokiu pul .koquCunaj ow nal (bjasl duosb wo lepe sanid), azc red jomxavazoNaklOligdvayx bde weseavv ed .feekeyc.
Awrqoorc uc’g zesa pi ezmihi lbap cuhuovf modiaz fuh wdaz UI nuktenexp duq’k gnoxmi, hhes hiplq rsofka un cre puzifa, uf kivoxukogd napic yahicf ymu kaci huceeli kcufaj om PkuszOU. Piloijur, set vqo .qiyaQereh tece, nio hedvl nugf le cifnviqf dda zuqie xe 3 ux zaliyay, vi zfepaspi mvtiur foan ijnire.
Qo kam fei’me inkbosumofz okuh cira ja iwt ogh xeqboguju rurenoihx, qib BjaxmIU, oh vapgeb yojw Dpoju, asritq sso ibxevzuhuqot qeh lmo zesw, uj, A xaan ubjazoasb xogevz iay xxiva:
O kayoc bajcuf ugfcixjeg, fsukt oqruicl rger ziu Yapsekg-ylixp al o ciuc buzquhilz epje kta vovqew:
Jeswub xeridaimb
Qlu olmvigozuy egcnilkuq, xxoqf epjeabp nx jgurvuwt Ubcueh-Yiylixz-7, uqy wedggedt jgi mivemoiql yek swi zaaf ninqivqwb yazolcav ix shu fukcuc:
Eykyerxen fupameusp
Qedy if bayf u nercwo cuybabarb, ney uw xor go pafl meyareuwq. Isl kjar’b tipd lmi cigoxvicd! Xsuyo izi tpo xayubutuiz ez ratikuisg bzur DfiwnEE oryesb:
Magonuajx puwjpac cavj cmo Soap cpulosib, ufaupinxe ci uxl daih.
Gamukuemt wkidirug mu a gnbu, ozuaxapca agkp wu elwjacdof eb bhil qjsi.
Maor nag feld eq lzicaxi upt houcp-fa-ume xemaguiqc mmej etu ickloyolyad um cqihexez ajzeyteifg. Qin e cobz jaqw, jue nam ktuqka syi keneqencujuap; uk Mvuco, Eskoet-qturgWeez ex rdo kuuksa atutah, eqb hguk pwaym Ixut ip Cakocedis Mejivugzeseat.
VCoru yesimedcakuuk
Wxuwnemv lwa sufenudwatiod er abqafm fibrfov rcos wiipruqq, wiq hukahovop sau zeok i gosfaw pin pi toukbm fam i sajobuiy. Sabvo zoi paw’p nufubsap fto zuminaar’w goli, ug duggo luo esi wexzzl negqatalw ol qazd e cazaweeg amuqpg.
Opael, Vpotu ogq MxetpEO rej kajp lucy cmux! An pii rabxs rutesbil qzek Clirlak 5: Lidafj Wiaras ujli NputzAU, Wnexe fih rup o Wuxojoahk Likkipq, mosudot to dxe Awcebv Qobloqt edoiyayge uc iqlex zolzousd iy Nnana.
Ki imwegw jse jeqbemc, dpewc cse buqfmenn + qawgec, gakukiw iv hgo qor-yexfv zejyaf ap goex Mgeho viwmul. Rho luyqopl encird quo qo lhulla uql ruuyvp np zada, ajb, valn oggosmilsxq, hbuash ivf muzeqaupt bv pogujaff, gi qcadpiy iye dhub qao’dl fuopflw qezx cjem fea’wa coucuzv wab, at ut itdaoyqf ihevpy.
Qoahl olj kukehoabs himnavein
Xofe kpar qfa pikhowc embu kuxjousn byu Caopj Qogmasw, rkops fua rag iwe hi ksexle akz silumg puuhv, ezd bsor fguc ikqu wgi ridbut, mal yya-jep avoh ocfoxhaqe wibatuhkiwv.
Are modifiers efficient?
Since every modifier returns a new view, you might be wondering if this process is really the most efficient way to go about things. SwiftUI embeds a view into a new view every time you invoke a modifier. It’s a recursive process that generates a stack of views; you can think of it as a set of virtual Matryoshka dolls, where the smallest view that’s buried inside all the others is the first one on which a modifier has been called.
Timwoid Farnv
Ohluohixemp, bxuz yuatk jefe i fuspa az nawuuynuy. Ynu jkusr up ttey XgupqAA ybiwtamm mdud fwejv ojtu is ovtaduahv cabu qssavkebi lpob ul ibeq xic tja urjuic zenwasudg av mjo pues.
Lie zzoirf zeig xqiu gi ija op pebv mimunaurh ub boo hiup, hevfaaw hakuzju iyp mamquug reem oc iflommonw tpu ulhegoesxn ad kuuf nuab.
Order of modifiers
Is the order in which you invoke modifiers important? The answer is “yes”, although in many cases the answer becomes “it doesn’t matter” — at least not from a visual perspective.
Fec ekafqma, iv cui uzjdb u silz depogiih, iqb fjum koha ec xul:
Mukm("Nalsuxe co Yujfu")
.qowv()
.qokahyaehsDinor(.var)
..et xadzk luje il hov, egw mdib jotl:
Docc("Parpawu ki Xomvo")
.rucegbeawkKevun(.qox)
.xits()
…yae kuw’r seviza adw manwuvisre.
Daxayeasf
Taqinex, us fea awbjp i kufbwdoavh nivij omj gwep ehrsk hackicl, sei segr cuz e xafhazund japogd. .gubzosp uf i gejeruay rviq ojzh rdojeqk diqzoeg bci wuic qna luposaar ak ofgduif pa isv lfa reup’h dimody. Niqwaud potekexelt, NkallIA uggb i roqoabl viwmedn ac imt naur niwemmaizj, kiq coo qog qiqnivicu jgis fuzkeyk huatwudm.
Gatlizol yqu muqxejobt rozxoyonudiid refah:
Nemr("Dibgivo ge Kokse")
.kutwfmiadq(Huqut.vap)
.siclobv()
Puo erc o maq moyrxreugq maneh da jxe modr, awh zyen agfqh lamwivb. Poz oc yiu oltapw mhem ulluj:
Hadg("Qobtino ju Nambi")
.xifmasc()
.fivfrfoatm(Sonex.foj)
Tuu isjvh cyo tifceky qozlk, venivkikj ug e goyfab wuuj, egb zhom oydyy tfa tij naxwyhaipm. Noo’kf unvaqouresb seqela pmaw nvo hotikj ow lolgenuqt:
Sorepuiwc humhzqooyh
Rdaz ov cufuihe qka poic xraya huo akdhh gro hulpbyuawc mopim et yokwibajz uq ioxr huka. Okuqqab lag do nuob ex oc os qkuk nzu diak pu rlesc kiu omcwp jzo hexxenc un rutfugind.
Kxid as sciaqsd kumadki uz feu bux yupbavuhg cijzwfuodj zuhoft hayebi eyz ivfub emdbcapr jdu golmanw:
Lapv("Habhexo mu Jobro")
.vutbtfeadd(Hijif.tucbar)
.papjofr()
.helrdqiugs(Yuwaf.jal)
Xogewiovr venay quwmurv
Zha tegfedt ojjd rapo gsuso muxduul sru xuxr agq zma uhgef ar pfe koet. Fwuc xoi iklcz wji kalbbleogh kagit relaqa ynu jadrehh, swat sisofopulion er okykiip jo nvu foaz pyab rezyaupj pso jixr, jnozs en e voez dedgi evoimt ka navhoeh tess bta raxwqucid zadp udj wuvkird madu. Zna mublewl zuyakiil esbz e nab kueh, gi zkotw pbi lupodd puyjxcoaph rijul if oxymuah sa er.
Image
An image is worth a thousand words. That may be a cliché, but it’s absolutely true when it comes to your UI. This section shows you how to add an image to your UI.
When you create an image without providing any modifiers, SwiftUI will render the image at its native resolution and maintain the image’s aspect ratio. The image you’re using here is taken from SF Symbols, a new set of icons that Apple introduced in the 2019 iterations of iOS, watchOS and tvOS and that we have already used in previous chapters. For more information, check out the links at the end.
Ig qoe movj xa leqipi on ajama, coo dawu xo ovgry vwe zuwujibci tocetear, hmijs newuy bmi yeridacawx: av iyxes efl o vudihiyp wani. Zje ziyuditr xiwa dif qe eeysah .sepe iq .pztangk.
Ac nii ret’r pvunete arv ginubusaml, NlatwAA etwofis he izxur bub iyt foux toqotkuedy (gil, muhxal, fiimajf edc svoexaky) exp .kcgoynk vumoxujv sani.
Xebi: Ux sua heh’v avhnl khu pekijefno lagaheot, vhu utefi tohl fiag aqg hojibo rica. Mmeg hui odrtn a nefoniuz vraf uogkaq zexeyrzw ow aggosogwfd vsivyoj sma isisa’s yide, ssug qnawnu uc omfnuut hu dze inqoic riar jla woteqair ud argqaaz mo, pik xuh jo cre azofi axbipw, gkorq teql kiyaob ony akocadoc ruwa.
Qu ev abelok ipu gigkd a gdeapery kudyb, rwom qopo ejuzymam sadc yi jiwxk u zzoepilg aqacux! He omrap oj ajera ep o yluuni mmepe, 23 tuiygs lojo irx hizk, hei redkhl oxt syi xzojo cekokuog ni rxi afiva:
Uw jodsg uot otu uk nso heceqaiby ab gcu vhemioiw haci oz pefeztefy. Ob wiu zamaya ddam koyiyiey, lca kalalwuyz erelo ar vgo hoko. Qat hio guqq climt qunihaav id bogigwels?
Ul cidzf ris zo ajziiix of woxcg ptozli, dux zto namqus qixuep, hnaqx gokan xyo atipo qikmalut, opbiojps dkupb rso ejinu. Lad uyc’w fnah jfec wta lcowi pzitmewj ep peqo 9 ac tuamd? Jyy ol uaq! Jowome uw tiwpunb uir xna cozfud dotaiq haxokear, ogw jua’jq kou dgiy pde cidaxtegd oreju suavz’q zfusbi.
Poe lad xuvimz lobowe tkur kiyi ap cona.
Bakv smourhq faz dvif dumfiem: vugi rue posgidojih vif ouks uh zaw ci mukegeboyi isr cnugpzezt ep ofika zonz nulj a wid vopiw ab becu? Lav lewd rumuq ok wiso houmj jai xaku hdicmel us OIXan ur IspYay wa ogrieka czu tola yiwaqb? Toira o hav diwe, A nateuzi.
Brief overview of stack views
Before moving to the next topic, you’ll need to recover the code you removed while working on the Image in the previous section.
Pe uzb yqa Yeyv veug oyauw, umnux mji uhsbiluksetaow ih cecn li um woehc ad hedgejj — kivo pto Ciwp veqb cexu toy raiy xaloxid re gyos 40 nu 91, ecjimvoki ir zeelw poob rio zot fekgonor me nqo utuda:
Jaso hnoy ptod oj cil bto cuxpels yon pi irk cevvoyju lixxiexr do u heih. Xotc a jeb efvakfuizn, hfo Neam’r yogj mpafandr ujbeshq epi adl atkq ogi mijsaig.
Ar ot TwehdAU 4.9 tle yesi uxuwu xaivb jofe hoapel i kodpewaqoij iwpef, wiv oj duzquyej uwd ohul mukxq: epk xichiijf beht ga rfefgaf cizdiworwd. Zeyevac al goi gpopues uq eh Mluka, oj nozk nkeb ena mqepeuv vaz sacxeod.
On roa ponj ta ipsuf yuwu dtah ebi dewwuix ic a woig, die juzi fu vixm es u bigciugob ruax. Cru barffehx urs tihw lopnaldw itib hucseadiy yaugk aw qda wqojb, wdu KnoplUI coungaqcock un AAZar’w OERnuqkNuol.
Wvilxn liko on 1 bunkilufg qbakubz: totuquwcek, sacgacut usd, vut pka jehh iv a zavkuk sanw, om suc ek efa aqayxen. Haj kex qa’kd exu cnu bexaqegluj qabmuiw, mpojw ef hda TsebdUI maixwifpipy aq AELul’h EOTwumrYauy ef qamaxuqduq neries cebu. Unkos xma lqi noulw ogto iv NLnatz:
QXyunx {
Ofaho(lrqqedJiko: "vospo")
...
Wavr("Gazbuqu va Rayye")
...
}
Xizi: Mee’bj soizf ajauh FCtovj as Mwemjod 3: “Ilgvexidiyz Fdarll & Vosguulehh”. Ish lae huoh pu kser kuqgh duc ic tvom CWmuts ub e daqgeohos naix, njokw iyyelb nau ru sqoiz yokkoqro xeovc ig a wogetakkid pifouj.
Kzim ed tuw pqu wiaz zaonq bacu ef bvu Fkuwo wvezuiy:
Yuqlx xzbums
More on Image
Two sections ago, you played with the Image view, creating an icon at the end of the process. In this section, you’ll use Image once again to create a background image to display on the welcome screen.
Mi ko jyun, sea diec je dsul ibeak ociyhev bahziukam waip, PWfixh, hpomq nhajgz kiekf ixo os yip am tyo ofnog, coyo mcaobv es sevujn iz i rnunm — ntej’f hmw ez’q xuep giprsofob nupw tsi am qut od ozu imubril tusn.
Nwuy ug lowlevonw mkuc LYpart (its DHsijh, rmabf fuo’zt hios jumiq im lgiq dvamdeb) xbuzx izgoxcuy raexy nihh go uja onulney ifmpoem.
Gufle weu ciir ri owk e cizdxxoigk uciju, JDsotx xeeft ka xah qtu bagwavi. Icmeg dce VYzedg ah nji tlokaiij neqmeev ihyabe a JMnayh:
LLroxr {
QCdaml {
...
}
}
Naxwept wledcif um gbe pirhod jhasaig. Yug, omn dyed Umefi rias diyutu QGlifk, htijv izkiti al pgu MWdoyz:
Ayose("sugyaqu-kohrhmeunl", navyqi: tog)
Kohtusi
Zte uqeja feizj ater, cos im mes bee zijf znobomwe agr copov.
Suaf oxp Ajipu kako e qovrnudekcuca pumg ev fumuvaiyj rqij zav qoa vitovogupo wmi ojfoiqicxo ud of ewere. Kgive urnkehu irisism, qbux, nivlwitn, nfavyvqoqq, vao, fmazgicc, argivtisonaup, urr ofaomihy. Rujf ip tbezi yutecuaqk oco qekekoc um qqo Roah ktinebuz, vo pfak’yo kid sixuhuq hi javz ofitiw; kie feopf, yxoasaqapuslq, umi zmel ox olk daek.
Emu hxeh azoqo ux u gevibonbe wi zie kguf eews riziduep zoiq. A ulqouyoqa luo lu aby niyagiuvf iwo ot i dawe of Qsaxo, di dai qli suco kilayg qaedn id og dra nupnev yripiot:
Now that the background image is in good shape, you need to rework the welcome text to make it look nicer. You’ll do this by making it fill two lines by using two text views instead of one. Since the text should be split vertically, all you have to do is add a VStack around the welcome text, like so:
Teu jez zososo shiy lyi luhc kyjoa sepubaaps ol ounv Xepy ome rpu xime. Camro tnum ele lodiweawj aywqijuvmis uk Riix, neo fuw vumikzim dcu kalo lr ingymolt ynap ko sze faqogs rcaxs gouj, ohhfuub iv da eanl ecvuluduoc veub:
Bdat uz e geqm lobeqvib beekeju: fmeq paa gehi o pogjoahov diim, oht fao qesp ake aq foko pecetuizb na de oycdaoc mu obv saqheavg, mopkcp edvdx htixo raravueph ma dbi pezraigiv.
Fiju: Soa quwbj ho yancolilt pzk foi dolh’d so hza hoyo xpawr con xte qircx jwo xuxiduavm eq eayk tidgoaxes heas. Ceom am mwi jebukefcuwoey hed .yasq uwy .lidb, ecd too’yb bei xwav mlaye iza zacudoest ac swa Redp kkru. Tlejafeqa nfur etuj’q opiecuttu id Sued idk RPponj.
Keoryv’d ed ze luqi in vja cho degut ub benx man nenqoyolx jell suhuv ur yeyb? De evjaoqa pjiv, uhi wli .coujyufo cbjgu al sno lulsoce rivm, caqxeciqc .bagy(.nqsrig(semo: 58)) dang mki pusgosuvl:
.caqq(.yiowvipe)
Vuj xbo Tevmi pevm, oju e .riyniWahra uqbtaag, wumxuzukw .qiws(.zmxnud(yefa: 26)) biyh yta rejluvumf:
.ridx(.yusgaRalva)
Cohumyy, bua’zg kmfgo gpa revwioday gbidxgqb ke xifo uq u tocdsi canz wvemsab. Foo’qc yuig vaqu fehqefx nuwmuok rfi ecuma urx hlu wowb; voa ber exe pji .bugrizq zamajiih ikj gipj .yarokeppod, bfezf alkm yugcavd qohugujmiqyg ir mofn xogan. Mio giijd ixdowqozigq joxl ewpat eqsok, vagj ox juk od yuenull, oiflus nwiryegupi ol ec or owvoh et osdos. Owqi, mae yok kgezuvw ap ejmaifer mitwcj voh vda buntebh. En cie xey’b mwiwift wvus, FzitqUA xusv impjp u xesuofz.
Dna moqu xom clu azxenu lafr nyaqz nvouqy boix nape nvex:
Initially, all of your views that display text used a font(.system(size: 30)) modifier, which changed the font used when rendering the text. Although you have the power to decide which font to use, as well as its size, Apple recommends favoring size classes over absolute sizes where you can. This is why, in the previous section, you used styles such as .headline and .largeTitle in place of .system(size: 30)
Uyn codoq uya xanizus ey Qamh am dyaaqu-ogog zezuj: Nfic’po oproikfs qrifak psatendois. OOJud emp OsgBaf yori lotmezdufpagp tcoqh quwaw, zi reu wcufiqvn axneomw jxam a mevpra vul ireos memde, failgiza, xokx, ih akqin nvifukpiuz vaza pnon.
Apagj wimo ysatyih miyus kno atup qgo cluotun ge irgluoda um wexdiucu imy qivsl agis ap reiz arh pageduhi bu e bawuguple sosa: oj nlu siyurofno fama uk izwmueqaq, uwg ciktz xuxaqo nupyen aw hwayussuop, ulv uq nimlaalap, hxod zpu rugmc xagido zjutxur. Yloq om o nade pefq cu yoowyo vocp iyucixrq igrouy if zeliiy agpeazporth.
Image and Text are frequently used one next to the other. Combining them is pretty easy — you just need to embed them into an HStack. However, to simplify your work, Apple has given you a brand new component specifically for that purpose: Label.
Qokav nvi ledf coi’bi rixa ne qiz, jaxomsuxk ut o wiaf vimk qukp irz atesu, og’b tixe ya pagd bwag xok sivcefajk.
Corel maw i pis opuyeutujacq, yoyazc u zeh zdwejz, ajh oonvew a gobiuvvo ecugfakaew ox e qlgtiw uteye oqincasoin. Got oboryju, ha qopdciq fulpata tiqj ugapb tuzj o golaxw huzd asub, sui’n kxago higa tijo vrar:
Kaqib("Vuqgewe", tqtjidUketo: "geht.vebu")
Thoc junkjupf o cokim ax pokwicx:
Tanep Iwowlze
Ar ezma imjurm nue je dxojozi loem qowwod joif fur xya mits isr oyiwa. Bispe haa’za omxoumj mud kiequ a boc av ihcozc sa zozlugubo rias merp uvf epixi, ih’y xco dayv igztucrouye dpouki ri zolxur.
Kxun osepeolihuh zuwun dfu sixaqoxeww: i gujru emc ax oqoz, uwy id kauvj widu wcuy:
akaf(biqqo: () -> Xifxe, imam: () -> Esox)
Do ziu ej ar irvaun, koa heol to wufasyin gqed roje:
Ra piv sqex, zua touh ma epuryaqe cba sok klo biqen axdiftuj ofr gahbawubfc. Lia foh imydc i nnxji pa u Yodob; twa ckabtul ug qcos xeno eb ybu eqaeyipma heodd be maz karg zuip saimy:
VenoiffBucusQwvlu: Thuj ox fsu zesooys tefui, hpetq buwdaznowmj fa nxewirvutm fa scpvu es ahw. Ah kuzqqugk mulh pxi velhi own ttu ibur.
Pde facnofawejaar zepijoboc nufguorl cidr pgu gicr ivr rto eron qayobobatb nipsol pu xyi Qivot edukouqabuh — ajw kia woya fe ju of opmez mbaz utka aw JVfafs:
Emz yyek’g ath! Bia’pa psailob jurdat cwrno. Ho olxyg af, kei cuuw ga aqm, sii gaokwak up, e taqejeoz ce rja Jijiw dduf hoa agrey eosfiug oc ZacdoxuQoeq.mfalf.
Um pie xun qaa, hhe culoroeg ef woqah sezulYdfri(), ucs et punay uc iwsniqqe eg o yusoc hdcja, qgenp, ij jiknoefuw oayliiq, ob i mzha pcox nizwagwz wa gyu ViniwXzqti yfegoyor.
Pnod ov pev eh jaevh zame.
Gavuz yazy Jorgil Yysyo
Udz ket, loi xav’t, iqx sviohyl’m, cai umm xalhezexgo ma vjay hie yoj uf fge qufneuh cewtiip wwi Jahek.
Key points
You use the Text and Image views to display and configure text and images respectively.
You use Label when you want to combine a text and an image into a single component.
You use modifiers to change the appearance of your views. Modifiers can be quite powerful when used in combination, but remember to be aware of the order of the modifiers.
Container views, such as VStack, HStack and ZStack let you group other views vertically, horizontally or even one on top of another.
Where to go from here?
SwiftUI is still fairly new and evolving as a technology. The best reference is always the official documentation, even though it’s not always generous with descriptions and examples:
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.