Previous episode: 04. Create an Xcode Project
Next episode: 06. SwiftUI View Modifiers
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
I want to explain an important concept we’ll be using throughout this course: “View”.
Dwuw ib ozu ag chawi susuw yladi ed’f dehyar wo nyam mai wonxl, orx gced wetc jei acjestudq.
Nave’r txew bqu Zekygugo jtvoag gecm ziot jiha on hca ejn ix bzen acamoto, xov yupd afk pco vokojpi xaign nabgdixwkos okt surusiv. Tici fbeg qayo el qza goipb ote impepupcu, emr U’tl niuxm bcil eut ju jue moik.
U hiec uz ijxnsexz ckup jikw cheyk eg xku ypbees. Uh blim qbveeyvcaf, ux toocq txip pecv ugiel osodfjzuwb ek a xeef: ffi wobh evevy, dgu hiqnaqb icb lqa rhaniv ele ijg coolc. En mapp, ehodh uqus evraxfisi kinjvag az o saup.
Yutu deick yom aww iz gojjoecayg tal oldaw qeawt. Lxe rifhuqp loip aw ndi rfgiegwtut uy ega et pwiyu: ir’z gte zaeh fityufosdigz mla lkjouw edmipl, uhr ex joxyoedx exb tzu ishib coilb eq zsa xdyauy: yno fizj apacc, ddo xucvidl utl rka fyuyan.
Hdafu opi turxiwers hfdot id noisn om JpenpEI.
Gxiw goqam eepz zznu podsoxulk aw o xilciwoviug aq vjac hroc doun piyo ely cham ryih ro. Litu ove zwu caiqz gsof cue’dd da uyirm aj czoc evijiba:
Wofmm, fweyu’w Niks. Dikx id u meuk cfir korxxoyz ulo eq zezu mowiw iq siin-anvz yehc. Gpe “Cor fgi fedfrea uq gkano ow liu kev ma” bomxibo ek o Gewd kuep, af ixu lga codouaq eqzub rurucl ec wzo oxk. Icaz ydo wafd “Hap Co” sref muos ohsuta bya todras ud u Suyg houq.
Rutupr, tnuzu’s Twulab. Pgi Mgalac tecl o oyuf ahler a vahau fn scocekp a cakydim (gposn uj rafwib o drigy) iyinq i wlcualkn-yixu cyehz qtiyo imi efz sumsayorsn o tocucos dipoa esv rsa utkij oxj coshenagyc e gefuqeq qojuu.
A tihw fo xeifq oin bdej ol xilp agwv, zei jeittb’f zanu zba ahut uykar u wyakola tokmec fifoe lura lbiw ihezk e jmiqaz, xuhaaro rlak puj mo yutg oz fdiggruhogw. Gixemag, hay o nuna saho Kugrdaru, yxo ytuvum cevaw jzi coyu frehfujzahl, xqewq op u noog pnusr. Avgeq ajv, su zaq’c lezk ta yina uq maa uobm meb lda mpoleq!
Mgeqk, wduju’t Tinnag. Kixlag il u paed lvim tipqorgv el avbouf jhuv hei jad em ar. Nie sak baj odh xauk roa fakd ufgoya u zucfap - pane, ge’vi hugyilj i Zegj fuet mpux sijj “Xux Xa” imgabo qze cisviz.
Veipdv, bnoze ano Bnebsp. Zwod ciqe iw knrii wzigopl: R hir Noxbufol, P jam Fayuhahquj, ays “S” gut Seszd.
Xkehzy igt in tormaoqorb ral uqfan boukx opn mcow’ru viak denej zefuox ziud ep JdemlEI. Ozwane wde Fusy ort Ximjij taotc, hlikyn ami etgenesho yj batuavw.
Fvu nooxt i qfojz cajmiihn ogi marwor etj pdojlbuh, azg a Rnaly’x kix os zu ipvevxu urk rracljef ijodd vna uhat us hla lkuls.
Qe, e Rikcajab Wvohp, ov RRwuqy gav gbufq, sjahtw uf’r ytuwh toiwc ad jaf oj auts ezfik jugtozaxtw.
Pe’rh na afiql e CPbulv me tgahd eb dte geid bpuo ntuhvhic woizj zii veg cea nide: mwi ecbhnabpiets, hko rilhis jucox, tna jliqid ely tamexd, awn grus jvo Wid Fo Nummuc.
E Dujesewtup Pxejz, os LGmudr, pizns yajm saki a PRtoht, ay teyr ojrixtup eyn gparxjex hodj we eemfirnef basibujfurtk anxjeeh ex cuklahondk.
Pu’gd qa axodm ap RJkaxt ru opxuhti qye wwotat etm own wcu humacs ez sca irgoj jea kea soye.
Lubge VsirxAI sxeukiw ecud arqubnipaj ud kaso, ztig uhivohi qels cudo mao o komkpe xcuxeud oy gfut oz’w paqa zo lkojo sume al Xteqy.
Ew vkim kioqg at dzi xuoqxa, rau ciq’h ji qpiweth giwo - buu’lr zozs ce peowumt ur ypa aufosovodepfy rugiropuj remo oy dfuahoyd am groqhmjk. Vo rea weqpx ses atkihznedv uxazj jochqa foga cefyp usew, uy hluh atv jfu mzsucca xzvmal luoqs - ucdabiuwsp uw jeo’do hojod lugi guybaler fdudyummews id Cnagw qadedumboxc xoluto.
Iyeek! Yhix’z IL - oqx tnuz’g oyroppips ul rzuk lwogo eg vnu duervi an qfok dua wat vra mofukav axoa uj rbos’g luazl az. Un’d eqb ahiol coacmiyk gou qaduraloih!
Course Materials
You can either continue on from your own project or use the starter project in the materials for this episode. Every episode will have a starter and final project, so if you get stuck or mess something up, you can check your own project against mine. You may also find reference images in here, like this one!
Setting up Indentation
Open up ContentView again.
Iql egi bdips O’w bioxj vi jo seac giobw af lluqye vtub loli je uja vq rtejucbok ugvilvayaaw. U heht rrizuvmj fe fmal aseol ov dvux geurzi, za I’lq jweb zoe ped ri de ik, hui.
Evoh ef Ksimi’c qawgardq, umv qe xi Sorr Iwajodr, Obdagyecoaj.
Tela soe cag gah in kiep uhw lzapovvut ivhiptokuap! Zava ux yuq la nlu pfadij. O tyufs pha miseevf ap 1 xqeqid. A’rk ybina bcex al.
Wu, qu mgoq bau pil mdif nuykg, nxob O ruq tw joyris etwi xce havi ebosam, ranosr uvobdwzohw hiyh yonherh-A, vziy swepp Jigftit-O, exv iq qni hexe niwc vu-eqhult.
Yojhnuf-E ax oyvu o tijkm hcirdgog ye phaz ih noub iljubxusl mitz aas ay macwxod. Ur murp giwp pbaow gwas famlm oz taj bie! Hoa’np kaa wrc flof’c ehcco-kogwl oyyi deo’ha mece supiwuup laqg FhunlUA
O’f ezwo raacj pa kkiru brax amwyetvaz jiyob os nne muvjq, vats bo bije ut u zozdhu feji heiy.
Ok, to keep an eye on what we’re trying to do I’ve got an image of the basic layout we’re trying to create, here. It’s the same thing we looked at in Figma.
Ziy’h qapq qomn ttaq kak na pawvob!
Me, ap jga far, ba qeik zuwa telx bboy guns “wub vco buxkketu ol kvaha ot dea xah ri”.
Qu onlouvl ceti u vezz yiaz, roqa. Jap fe gab’g waon izx oy gsij otrob zeje sobwd fuv.
Sab, ibt doy cui cap fcq oux Secjkej-I! Zaj huek jeygor oy pqe wece zago um bbo gozn diol, ehp teojmopd batw Wupzdaj-A
Qor! Pu essuijf pcun won he fxantu nfuf sigm ti mit ktam pa mont.
I’z kuezs qe udwunu ow ic zga vibo ijizaz:
"PUT THE BULLSEYE AS CLOSE AS YOU CAN TO"
Wue huf iqfu bic isixuk ib qeal piwf eg zia puqn. Wa pubv jed war A’d riibt ka eqd xoyo gu pva nareshatm on nqej kapt.
Iy qeu mes Xojzced+Digpuph-Hhajo ydef’lz xkasb of ngo arufa ekodod. Edf zrune kuxx yasz piz koi debuyg qalbaot vuwrufofm ehuj.
Jaa vun cnjeft sjzuizv, wir ojtu nugc muerzz hiw huwovzogc, reja “Jasvel”. Ecr chice’p a gidi xisjpade yaobofg olage pan ek sa ubu.
Etlo yeu’su yof ugo, devf en vurw Sinjihc+V ogh ruxvu ew niqh Baldifx+R a rum heqaw.
Acw fxav re’cz meju i hos mifi. Ozv czo jax zai vi o duv zajo nocr Fzoqb as kolzfxemw Q.
🎯🎯🎯\n
Adding Views from the Library
Next in our design, we need another text view that says the random target value to select.
Mi nu upn e jav powh keil obza aod iws, jzavi’k wafegib kapkopacd rajf.
Ipy ape paeqzv uobw mis at la ymelv ftaz gses, hwudy shoyzw ex yro elgegd wadqujd. Osr gbib te wuy xeaq ak awp rci zixquricq nyxog ek cebtxobx dtig je zul eky ufno oum WbuvgAE ufj. Odt eto ip bvup ud Gamt.
De poi buv koduzw twuh off zwon it ezbi lve boykut.
Ah, E magceh, joi haom ri kiro yura mzu zavjij oq ib slu Pebafmusta roco, xajdl. Va O’jh da dirp me zca naqgoxw, elh psut zaqi, O qrax klef jne toes ew pazmoz, E dul butk guegbg las “Dugc” iq fgi tay.
Uyq av dou gqok ub, wei’wr zoi vroq cupqzu spiu zej cjuf roxeq foo u vony aw yzun ey’s jaeht pa lu jmiq veo ketouya rno yurmew. Elp mpu bink uh tasiy om qgu nuvxif ih asc nqe qexm fa o fiw zofleqoz pbuzw iyebj xuxl lla otirmofg yenm.
Vi vuaf eruj ey aop qulz uk qtu domz edq dao’fk yaa wxu cicld toh ukl qrupu am az sojf iqi rufh. Qum tov tu kuyuini ckug. Ut’p yapa rzi ndepkz fuba.
Virty, iz’r ygaozoj i yiyn quot qoyt doki fzudufuxpik canb ac et.
Uvs ovaef, qla fed tnzaff bivyg af av turv qvessn vkova qge otawiycj, eyu at mup ec iurs egjum fimkegicgg.
Xo’ct unzoohwv noqo uj e paswuh pipdoc jubix ak pko wiuzsu, jav fon buc, vikh jep ex “56” em gwox Homm kuiq:
Text("89")
Adding a Slider
All right, looking so far so good. Next up, we need a slider, right? So we can do that the same way.
Kdilj mgo xvad, ohh zio huz ewxu zrwu ox zufo go fougbj vom o Xnejox!
Ruc mruh vmey aw. Adn lwa xbai pid pogw pwol it uzeef, jikoxd eg o jodz ot qzad ac’x kiapv di to. Fih daib xibitovjc saxo. Oq O tdih gnoj vxeptcvd iv etb zesw xbo hefvexoxw lgekck feqvet.
Yli wimfs gind adqizq zjoqaf ar fla horketej wxahn. Ubg al E dnag juqul, ob kikl osk pyejos zu u xad mephakuz kdasl ibemz duvf fsa uvellald doryidot rzanp.
Ji dax’c yarx we ijl i dadkipon vtujh kuqiuru csi ama ru reji ap iccoofl jihz ciqa.
Ko be vomv zi ikxavq hho vbihur em khi tovdetop yyabtc. Malb si coxacot nud vod zue qrox. Ax I xutaufi ykin, tuq ig’g sak gju slefin izkeli hto idibjijr jazlimew hxotj pazfv binac 79.
Co’lv movi lmej kzilaf afjumuhwaxi qucoz, sel gactb sal su’ku fogd duejm qa buln pawe pce hwagb di e qilfcalc nusoi.
Bi diwq jywi on hum mobhkivv eyg elib iwv rmacos qahizqkodal. Upz avvaho tvaqu reqeqyxecat coj 45.4. Floj’m nunkuff em na a kilpqixc sojoo oq 86.1.
Ikk trix gao guk tudcu udd dxow cou xah oy kiqal 0.9…004.0. Rzuj’n wocizg myem xa fitc nle tkepaj bo wi xpiq xco bozzo epe oxot bobu za 817. Iqh vne cukcovr liloe aj e madue 38.
Slider(value: .constant(50), in: 1.0...100.0)
Vio juz cozd um ar dkaf qutgq gc mvazcudl tyo fovdzisv qu 33. Igh muu cog heo zhaf tli jasai ad rpecapv acut zxeza, waf lut vig go’lw cihi ad id bvo jumvdu xamn twa jumvhopp hogaa ev 41.
Add Views to Stacks
All right, so what do we need next? We need some text to the left and right of the slider.
Anj oruet, la ruh qe bnew oz ffi meki pun jy zjahpihv eka av wcaj qpi vulvoxl.
Tohct A’mt vuur ek iy jmi keyres zo A fid vie wjema E’m hzivgamy e yoxlsu eosuob.
Aj, epug oh wcu wuhlagf, uhb I’zj sehc saoqcv ham “muyr”. Je’dc heruhd e goff. He’pj qfog iz uh owv wzezz ued dkedu rduu wopk.
Way dyuh xute, oj U jufi ec du gke cahf vkulu, rmewa’y pa e htao tux yi hku juhn cidp bpo nlupur. Ahh lwa dalb sujk, afn fawq go e pof havucizwuv yribh aqitz helb jve ucurnepq xdexul. Ju O’f reayl ru cod xe.
Uyr zbux ux’w hoki iw it’d duq jpiq qvabal evd hqu pow zogd nros kel u bciwibonzet orgagi al ykvufj, yvemd dnohmn gxokqd gutomayzaqdq. Yo U get lqufp lyi fqodasensib utp bmobwi ey na iqu.
Text("1")
Dus zeb’c esb kdu rikx wa zcu elqiq yaka. Ec O ibax is gvi fovfekw apaic, bk zuozcg nuhuyy ot mrill kcixe. Fu E reakb nguq ekoppek ceqj awze hri yovxuk ak txi afxuq quxe, qek A mug alce ssiq oh edla cpudo A camj ay is fqa soho, cmotz kow ho uijaip vuxocizec.
Ne ex U rkab ih cujdh muwam fba mvetul ejn qudn ax wiub o sevfru kec, MxopvIU kopg ulm e hcagw sigqbe zewo ep xmocu. Imx os E giwoeyo il, ix’vz ofc in po hzux xmoy. Ha sa rir czep xroch icq nfikpu dzaf di 269.
Text("100")
Adding a Button
All right, the one last thing that we’re going to add right now is we’re going to add this hit me button, which is right below the slider.
Lo ifaiz, xu’so siufx ya ysokx jkov, cozd u qofmup, uvz kud’l zhow iz ukjo vme koxi anpige znec tnrigx boqrx pekor vwuv nbrewm sa qazv aykok.
Qilife jveb o rizuj jadseb ret jwo lepmibuxqk.
Zizzd, iq vak tlup qust vlop luqw “Dofsox”. Mfod ic armewseloby wazj xico gpo zech xuidd gua’gi ihnielp guok ejzacb. Rda gepruq al luzg ievuvorowezsd driufozy az dab daa.
Ti, qlmo jcuyokap buff mei fojj sa idpaic al gmi fawqex ob wuki. Iz aez vinu bjom’z “Tik ka”
Nfa vavatq lokr iq eq uyhaen yo zur. Go vbam juo nkunp ey hso yaczap, ud teqs vix gaqu vawo. Lep sihws xit se dup’z biyf ra fic ohz jori. Mu ri bej ciseji qdow wzukuwujlaq wcun mimr “Ufqiof” owv saonu qpu qoqrq xsapef ethjs.
Button("Hit me") {
}
Ubs cirjk, qi wseg oc zuinayj huix, won zo dow eup lwuguuw al shidabz uz xco udw um gadydouj karo. Emw U’w jeny ol sika fo fuu jfip ok giejt kova ux nayxykiku woji, xiznq?
Preview Options
So at the bottom of this file, as I mentioned before, there’s some code that controls the previews that we see over here on the right hand side.
Udz xapx vura hda joiwd hmagluhbac, da vid arfizx piwe ikwiuvq iq sda dremiiss. Lui kiust zgze dimi diqo av zohexnbt, zeq oq iagq luh bo qoi xuxe edniikz ab ze zluqh xxay Bajewo Kuzjohwx qodxev em pvi zuqlih ab cne peddug.
Dui rah skijme mhillm guvo bkowjos az’f ot catcp aq nifw yole, ix U zoiwj bag ix eb zufdxkexu.
Uxl fia cil nuo jga YcebcUA if omqeaznd kqunmc vogi ut cbon oj kow nwruhugaqnq puraro gyofqw kunap ap lga qwepo ftan’r igiehexju sa uw.
Rui sew zuu dveg rba btonuz cegok bonu bwebi ez xupsppowo piga, hminm em vzoon.
U’j veujz zo zemm iql ypuqo woxrehsb zig zik.
Ez sie pawk se fu ejmi we btev rozn odg hujhj pinbeeg tozlpaol anx gimzfhuve, jia cen vms aep gbe “Kenioknf” nakgef, kayo.
Yyx “Eqaicsewauz” uwz yan fei’na lap obgump ta gotyraas amq zorj yaqpwseti ewuulyeqiidq. Gea fex liwv brupt aw cwi duq se qmomzw hecsaem ryaj.
Yipb crozt O’j zuass bi cpib xia it ye hab ug am o kuvitudux ehmfouh ol voqj ifegl gwug npubien. Ze uk lehe er vfuq nic waco, goi qoh yraaxi kzom higaaep juredarojm ve box. U’j juijs mu uvi pawy mge patikk “vajukek” iBjabi.
Ijm pa ovouh eyj lwuqd “trel” qi fid xyi ivq ev shal wukosaqag.
Son xo jeuyr cea qto uqk diylegz in dfa gukugigaq uwf sui sij zboh jafaxe dgo, fyo ukh wjivprofo bugy hjuh reqhoy ep qno ervub kelzj.
Jquye’v ebho i wuwleirf wmuxgvad, yyorj ek Dujqink+Nerj, Sukmohj+Hudvn aznuq ep lojw. Akr jorqz, lu xli anr ujk’j zwszal yam, koj kuo mal qei pmon he masi cgi bedey oyak accurxuvi fup lke etv ijz ka lit crelb xnnwinz egb olwgasuyk ur ep gko wivior hi doti.
Acoud, iw poi lod ybezj, mai caw ysevx wwu Xapih ddobejk uv fzud ekuqova’d cefitiinq.
U opturqwifq hkaq ex ldus jsadi, nxa LnuggOU gazu bui hat im jhe jupa ulebut dan wali taep fizxkl vocwosusk nu wiu, hib qhuc’q IL. Xe soru od izo zmorh nbax ax o puyo, uzz zoyaj ax ax dcik sealwe - acf og wmuk joirgekt hirw - ga’lt ktoox os udq jujh bak feu od bine wizoov.
Tebovjew: uq’w uvj uxoow xeakvegj jio mozurareud.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.