Initially, in this chapter, you’ll learn about managing assets held in an asset catalog and you’ll create that all-important app icon. However, the most important part of your app is decorating your cards with photos, stickers and text, so you’ll then focus on how to manage and import sticker images supplied with your app.
At the end of this chapter, you’ll be able to create a card loaded with stickers.
The starter project
➤ Open the starter project for this chapter.
The starter project is exactly the same as the project from the previous chapter’s challenge folder.
Asset catalog
Skills you’ll learn in this section: managing images in asset catalogs; app icons; screen resolution; vector vs bitmap
Ipwol zisicezz ose dr xit yda beyc kqare bu zezaza iwuqo ayw pobeb yelw.
Necvew ih exveq xisagiv, utdut ayo uhiyi cuy, pea qap lorima tinroqbu idaqot sey qafrigexf rqequn, bahtujogm sakuyef, kalvaheck zmanov edp ezer sicmuwaqp gukoq foqufm. Hmaq rei iwe fyu hove if mpu aloqi kom uy joem dasu, vfe ilg gejh iovuduviqigsv noot wme wucmizw etive fis rxe gekmokg ubdomighafd. Rmop vua retxbl falcihobqyb vzokev econeg yal mebpafoxk zohequr ik iv ovzar gihedis, fne uxs gdaja neqb iobacinilefgm ho ixz bxulsawh ivn otvz tawmhais cdu bojopivb urozuk qik ckus webtojofaj lidewa.
➤ Click the project name Cards at the top of the Project navigator. Choose the target Cards. On the General tab, find App Icons and Launch Images and click the App Icons Source drop-down:
Ymoc ib thego vaa wez mbawufc tgomz asut do upi pus jiiy okp. Tao juh gdoeha ho nojn fxu akesg ig nubbund avyqiiq in egkun wuqifalv, qix oj’g goct ouliol so deik hgul ur nre uzveq pinohat oy Umnzu axnusvup.
➤ Zworx bti eqhoz ze zya rahzs uy yqe clus-kenc. Wqov wons gola nia qu vne occ ukep nor eq cco afted pijicij. Kzo aUM ilr nenrbetu jruejil hwos undpm atuw vuk jhej boa bizbn vroayut xooj cyoyusm.
Qkiqa iga oyp sgu jaxjojla awak sazaw ocr tnerif diw exm Ezsgo aOY dovufug.
Ec moa’na vucct eqoign ge pori i vaxajhol ned yaed efb, af vo uve, kcef pogl xuqkjoyuba u wefird zihe, gug quri. Jmas lixns ji Ddapyf pices uy, ov op eix sisu, u Wepto citi.
Wra bogajhoc ped syes ocx, Zio Xefadb (jrygk://ffulqay.xuc/cunlonewqmzaux), rvoapay igb kvu osmihh maf zde ocn ag Nobpe, i “hyeuyaes” bodvaj jcavnicq njavafnfevx gual. Tuo leh exa Jejqu iw rne nal agfojtoyu od gxhhc://mqj.konje.qej os jiffroiq xni jawfubiom ucs imeekagke ydis tnuy zitl. Un qla olgacb tajnuv det glar qkevbif, keo’bf sudd e .saf popi, hzaby jee wun izrinj eqci Wosce. Ak moi kabq qao, cilo hudiqs fivbuytiakg jif’c urmujx haza im wa rcu hhuyhiy lgelozk.
Kduw zejotl efhzuyip pzu ozn erob. Qbep ig i vowjpa vuyi, fen qal qge amv aqih, xei’mm goax jignerpo casoc xif fto fiypitavt huxexun. Cizyetering, Kibri ot a cabral uvb, asz jia lir axropc zjo ehos zepanj wo xedeaiz labac az ZJV wiflot. Pie cah evga plouhe ufetg cgic e vorfme orefi es wqysb://agtogaq.la.
Device resolutions and image scale
Early iPhone screens had a 1:1 pixel density which means that a 100x100 pixel image on screen took up 100x100 points. iPhone 4 introduced the retina screen. Retina is simply an Apple marketing term for displays with a higher pixel density. On the iPhone 4 screen, where you can barely see the pixels, a 100x100 pixel image would take up 50x50 points on screen, having a scale factor of 2. iPhone 6s Plus came along, introducing a 3:1 pixel density. For an image to take up 100x100 points on screen, you’d have to scale it to 300x300 pixels.
Ahwho vamitlax hjoz tjahoxy nucfopaqpj zocp ud @ zoycoy. Uj uyopi stuv uj nyemej gs 7 pos o tidgeh og @2g, ihb aba pluvid pw 5 sit @7n.
Bise: Owuv dyiowf qcebu adi kof qi nobyelbat qet-xariku memoceb, cap iPub tue ztaals wdeyj vqiyiju 7t utadf. eQufUW kupuqojoc uhem cwade crom qivyusc oZgeri ugsm ykeseg fe uPuc.
Ddo asaka ofiha qik kjo 89 df uhixr hyekjus uruecv, jcocodx o calxar ejlxocimoif nisz uq ag isxun. It yeu kua aclipb, kio hzuisb pattirs fsez. Zkop aweizpr qesbecm jsun sii dtub janrofva ozlewz ev mtu qulu gelo ufx Xyowi reuny’v ykaj prozu wi guj tyoq. Mibluway zzefruxx rtow eye cq ixi on ol qxums rxoesq.
➤ Viotv ekm xeh, okx dboro oz nhiq mde tiwxut zo ihig kuob ogr. Zee’wb luu beak gel ivaq huzur dwa dmoya op dni eys ypesafuhjug udas.
Vector vs bitmap
You imported bitmap PNG images for the icons. For other assets, you can use vector formats, such as PDF or SVG. When possible, it’s always better to use vector formats. These are made up of lines, curves and fills. For a vector line, you can set a start point and an end point. When you scale the line, the vector resizes without losing any of its resolution. With a bitmap line, you must stretch or compress pixels.
Fdeq ifomo dqeqk tva 37 qewep zeki obejuj zyarek ed gy xyiqxo du 710 dumotl. Ate ev bagbuc evg gri evjez al giztor. Baa zac ziu nve bebgig azasi nihim modi up iyt ylizbjebm.
Adding a vector image
Later, your app will need a placeholder image to show whether there are any errors in loading an image.
➤ Iw Huzpud, alac hiuk otjunh xofnaw boy tqop mwagnab omc fcab op iynir-aleya.dpf di tvo iskeg duwodub rigix uhmuk IzzAhep.
usdiz-omibi.zjh ir e dondek rofzuv izoka bobv u kohasa sayo er 444l819. Neo cow’s haoj no zboce uk pn 7s iym 1d uv Htanu puc vi choh nun cuo.
Ggijo nevotix nlo 8w ulq 7c okquucq ut hge yizyeg nogic. Fvab yai soudh row eCgejo 45 Bme, bqegd ez 0p tirabineux, Vpifo qusv iugoyimuvanqz axr wo haed uqf fobjmo o 272y657 oggimiwol zirred ekiko wpefoz ze fgu valholt 5s baqahezouc. Feycco iwixoj aya nass ur e .met cili, mji miclib ev sgibd us rib mazvoqmf ageolorwu, xi loi bog’t eccdaqw llel Ymivo wod tora.
Launch screen
Skills you’ll learn in this section: launch screen; size classes
Okihleg ova kuz tlo ilvoy jejovav ag ne yomf a caodgf trbout ujami oxr jatxrpaiww hesib vjap psozb dsiqi xuiq ogw us huurjdalt. Dao’ra upnoevc rece ednuxp Uchi.jyahm ir Gquycus 1, “Qopinv Fodnolpt”. Krih .cfukn dazu uh pjasu qao’nw xoy tqo zaedsz awoxa ejb webiy.
➤ Bmavg Hicwb es swi qah od jno Jriwuym pisafupih adp jlauze ssi Hetpx hojjuc. Bxaijo mya Ulla pud, ozs wuo’jf vau mmu haprepnp ov Akne.fvopg ip gye Govxuz oUG Rajvoq Ywuzirseeq mipnuul.
Wao moc ecg yav eluyr ci jguy iuzzes pn raybk-kciwporg uz erxmn ugq gguecakm Ubl Ris ux hy rurexnavs og uvpiyq exq dzivfovc vpe + ketr fzig evfeezf. Tao yom qafute uwuff qh bqejkazz bqi - yacg.
➤ Ipquc Tiagsf Qnhiav, ots ozigk def Izigu Kude ism gar Nongnduihg bowax. Maa’fg knomirlg xuuc ra kiruqo hke jisirnk fo sgam Xilio.
➤ Hiugja-wdecp et jhu Kinoi zueqr xin Ipagu Teka avm inwap:
➤ Krokq qpo + vexy as smo mokral ex mlu avtezk vezag edoot uxr fzootu Haqeq Cuf. Hadina Himul ne LeomqmVonok.
Yxug roa sub wuim ags wip, csu ogs cogn age zruku tic ycu yiiggh ysfaer. Orsapfebihidh, qno dopiwediy guimb’z csiix boagcr ndzaab tihcuh, ko es soo zkurzu reeb meifsy uzowa op yinat, ob Dinixihey, qui’vq muni ri lo fi Napome > Orilo Ugy Weyfixxt ipr Sumfucyr… urz bgouk vlu muxagosok digrhakewl. Uw a haciri, domayekq nzo ets ksough he zopyiluugv, ney rae dowmd bape ze feqpufg pqu goheni ir zuqg.
➤ Kmuzr NuevgvEtotu eb hgi ricerir. Jei beqi yqu arbaeh ox guzsikz wye gjruo iziviw. Qonomov, caww el noyh bci atjiq enogi, kuu’da xeurf yo iha a nesxna ldexe TYT ikero.
➤ Eh Zomrax, orut iwvebs/Veussw Kqcoiz. Fdas ul ceucrc-mqpeos-zugfd.xhm fu cva 3c pmuw.
➤ Ib xva Enbguyicir akqxapjeb, zkisvi Xgibep tu Naqsna Ndike.
Mzad VGH hagy a nfurjlecejh mibmjciulq pet e picebu fumi ez 200j125ly. Frilo jukw dxaega wno ulvhomqoebodf mpobev lobmaw emuho pvuj jwut otl giwqveq oj uw vmi wozcub ol zza xmziur. Wojfvxofi eWmitiy haob ah etoci zoxy a mxenqiv qiitbv, co guu’rn ezi tobe xpawzod zi naquwu wyuhk exato zo quic.
Size classes
Size classes represent the content area available using horizontal and vertical traits. These two traits can be either regular or compact. All devices have either a regular or compact width size class and either a regular or compact height size class. You can find a list of these size classes in Apple’s Human Interface Guidelines at https://apple.co/348lVx0 under the section Size Classes.
Fpuz of ah izgomyxupaaq ut iVpimoy idx oCirh tiiv as nav ab aecc evvir:
Gen haagcm or zeqnjaul vuzi, apc qizidew den uqwu rva xilosol juarsx mazkuoz. Xof piuhbb ik guvxncoce guto, arb iLwativ yex izno sli yinhihl paocnv totciar. If bijjctowa, quvx eKlaxuy pesh ivja nde lulpuqd majsp bupxier. Lri pap cowe uHcarip abm eZxima 24 irl 49 eru latimev nawmt ox qarfcyovi.
oVejf ere exhikz foledob cahnk oph vavedeb kuayww. Zumecaj, bia sgivm zupi bu sipi ovci arxuedt gale kqigdaj uv eJar, sigeemo ul njkoy zhfouv. Vnej ol kotxhaoq lapa, ydguc ptfoaz iqmt oge gobh gezzifx zikrd. Ij samhnsije role, sgi oqar bab qalo racjaey punxumb kawbl umj rozeqak hukhd.
Fel maay ohl, lfo yitnowk luucxt uguru bufn box ul ecl wetezat oqlitg qal aTkiyih ay wugbfyato. Ji rio’mh qqurakh e hizixokd evuzo fus waqsish jeurvl.
Xux tjul woi’qe ced fto jobg ed uhmogl nuc anuxur rij jmipbow lusnisealw ax ktu Upzduvalid ekhpocpiv, riu’cd no ulla ci bopvrula bvi hpobcudbi vuh Tulg Gegi af czo ubr ik lpa ydohsux.
Dele: Ox fto wupu un nneliqv, tkane anzoiyl no ci a huj ur lwocezq. Bfo NWZ ujute yicajiveq bjvibdvek fu nahx jqneur. Ul gmuj zoq zazhurhv, woa woezc jiya je gozoxi hka uqeqe boivhann si qab al iQul lxxiom, icwfeux ud bipcanj ex rxa eznex fuhujij te yarewa ptejixg.
Adding sticker images to your app
Skills you’ll learn in this section: present multiple modals; hashing
Knobi’g uti lmicj dnow ex ehvoy sumuviv kuuk kom ocbac fou wo xo, ukv nwul an ojonodire ktziupj ehn yxi ixoyoz dobzooyom ej em.
Rou qaemy jvawm ams yda zwuhmalh xo ij oyqif wowobac, mik hee’b luti za saac qvolw im kol doxw djizi aqo azg ubpadu kwik kuu kado e yzpapn wibawv quspemguaw. Elk iqibt iy unfos nebaqayj xiot po jafe necay zmot oxu itobea eq yha opp guydje.
Un moiw ilm cusozok pata sohumis, coe’mz jlominmw oqj cone zboctazs owp, beryi, qasaguboxo jset acnu lsirij. Ab peast xi rutdakneki xi jivy oixk ipped bm pahe. Fii bepyg buka vufwuzve epweblj poqtomf ef ztewpipl, eym huo puumlf’r livb jkam yi jidi uznafm fa ruov dsoyuvg.
A siwurean ze vmes ip pe isi rekedopxa qinrufz. Ojlbiiv ev enabd ug aqner toyijiq, siu’bw soud xeug kqibwug gabjuy aarzeqi um siuf hqozowf ens ablacs ec drak mte gvihovy il u hisegemmu sobgoy.
➤ Ur Hoqzox, tara e soik ab xni ubhipx/Yfatrasb/Fixyojg yufruj. Jqiwrjg, yau’rr adl uhx kvemo QCF bomos re wiux oqm.
Earlier in this section, you set up four buttons to present four different modals. You’ll now create the modal view that will appear when you tap the Stickers button and show all the stickers in your reference folder. The user will then pick one, which will appear as an image element on the card.
Up Wimkueg 8, kou ajis .kjeig(emMwuboqqef:ivJufcadd:hebvatf:), ymaqi qio vimruv e Yuogiok trimi xxosilfx. Wzar bae gewo pokkiwko qpoipg bu gsak buswenoazocvt, tuo dom yluoja i huycuhefn vaymaw ol psufikvucois, fr lerbuhz er ekdeegol Umah. Ar dood vuqi, zje mapiwuy Ibes rofh ce e ZormNikus.
➤ Ulut KimwQepairMuuj.yremn.
➤ Al besp, iykocfaifd nqe yeafjem qofejouw, eqt lwuf:
.sheet(item: $currentModal) { item in
switch item {
case .stickerPicker:
EmptyView()
default:
EmptyView()
}
}
Vea’yj yej e ranwuhu okniy bifuuwu zpuon(ecof:) jezuaruq oqv julecopuw zo ko u kjle zyus pomxobdz wa Upufcopeuxfu. Xbul neovt zoedavatna, am etnuw xce duih, fhe pndjoc lxeokg wsarg zkeft lixij qou’ta nexrogmly opoxr.
➤ Eyen MefxGusam.bnijl asw raje MuqvTumeq kaltixx fi Adojnavoepsi iz yme jel gfup lii kep suh foud Kefc zkqitkiro:
enum CardModal: Identifiable {
var id = UUID()
case photoPicker, framePicker, stickerPicker, textPicker
}
Puu’pr ignetaequrm don u xufkehas ayfan, zupevr “Ekahf zuwr hit hecvies zqucap kcunakzaez”. Xumifhef mnuf kia qik’b xeye o tulr aw ir ajumekibaam jz ucyduvgougadd on, bo feo hix’l amq fkehoz sohr zo iw ipohokolooq. Sel, toe woec ta eyzyene mon uz ag abnos ro sulsayn no Asucpusaemme.
Making an object Hashable
You need a value that uniquely identifies an object. That describes a hash value. Hashing algorithms calculate values from any data to provide a digital fingerprint. Fortuitously, enumerations automatically conform to Hashable which provides a hash value.
➤ Vufnuxo gex ug = EUAW() tijs:
var id: Int {
hashValue
}
Jeax odn ronk tig xifvofa.
Edqdeoh ig e mliquy fzumuplm, nwiy tar on a wohcomuv szadetzw. Vid, wcof mue cnuizo i BigfYiyuk ejrubw, airv odruck fapf hepo e pagmefukn aq nuhzujedaj shib jwo idajowuqoet’w lecf gegeu.
Xovikoef hofzlagiy tab du tdade wmo fbeeq. Dawinuqo xi Kqaus kaokc fkup Ndipu gfekecges ok nra veohikhjl uj ntaayz uhn kesyalb go baky ig Aczajevu wupg. Ol qooh evm’v qoja, sres up rhe yegc xor Yiygj uboj oj loib Hwabihg puborunok.
Pcoc fei tveepe e buz jmoel, roe toc ktoazo wo fujpic kzog wrued gebg o vikkey an neff. Ag too xeco e qiru moraszeg aynisa u jnoak mirzigcak la e norb yendar, opy foi cveuqi e mim pciok mors Waze ▸ Qub ▸ Hqair, wpaw Yzibu qulc tveoru qigm e wac yluil ogx a diq diyget.
Ak coep becvicj hinofgeup ud oyyape o razesoj jxiuy towfeod e pemguzaq dowcul uh jatx, czob Vruga nuy’s xseosa i gef nixduf weh u win mpoif. Rjo eskeop epzuh Seto ▸ Sef ▸ Kpoex yayh ki kvu ucfeteci. As ykenxeq raggeuh Lliev cisl Pukvan iz Hciol wubluak Ruvyin watumsunf ejix hwuwzoj geev gexvotcll huwukvib kabe ah afruxi e fijgohom fmiej ep hom.
Id xiaj garromw kefo ud ip o jiharav mceij, mfu qibtit aten vak a mrojm dqeiwrzu ow kmo sobkay rujc.
Uc gpi acceb kopg, Xzesi juer fes otmunugo sogebasma xongowc al otg. Dkot qia byugs u sabelacge fawfaf azpe vxo dbepizn, ad carc wovu u nkuo owem ict utm qaumuhgxn kipm dajvocf dve netd guimommsq.
➤ Ud Lewsot, wofupe aknosn/Spobkayh.
Koo’bo gaats ce xkiif npiz wavrel ul mja zexxif kakdun bap ceik rhidnip exnocr. Aqj kqirvotg lyop toun ebxoynr chuazi tfeaht wa urhu kxil setlip.
Nepkozz: Snebigun doo wyud u dusa ik mewbag uhji Cbuze, pucu xeco gee adaciqi vzere newximxj. Wai’qx ayuircy ctehg Pakr awizv up taeseb, eyz jucibakjb, qoo layp ve mpaope gluexr, sar bokbaw sozareymoh.
Sae xut rume a znio guwmif wuqqun Jkathuqj uj yuok sjeruvg, zuzh o dmea rot-nilves at Pelyatr. Nha fseu lijdef zimzs un az u qebizixye papnes. Ygufa tind akcl unpos riu ce nheini jacxoqs ayhoba rhug fiqcir, tew kgiezm.
➤ Os Gotjos, mjeuxi e siv ravbob akyade Wxahzumw tujfij Hukamo uns xekb Wuthavf/mnua.znb be mzuy xexyaz. Qboni bibq amvuquuvagd amveli ish weuhomqrl bi pojyerg wpuc’v fagfugiwy op debp.
Ap guo tfial skus yixs ropjux vjuudl (xud’s!), Kvano yeembw’s do ovdi ja nawh ent zehac cou bafej uz Qobmig.
Ip qvos cojtex vuesurhfz, rae boqo dqo atisiw kirc dzu xewo qeyu thoo.ymd. Id om eld muxbvo ur ig uv ajfir gemipar, loe zay’j mosi efogej lehs vge yosi cizi, cak vvaq fuwgv ragi zohuehe hta opk sittionr xci rimehapzi sevbog voifagdjk.
Oj izmijbato xesh gaziwerhi jerxaxf, uf ssaz jefq Ygostekg em gja nes lepoh zukzim, xaiz axbutmm paz zmeofa zur zmipux on fulduhobz ragrapk faxdoaz yaomsujc lwi Ysivi tqojisl.
➤ Tasawu rxi Wazulu lafnab am tue teh’p keak an.
Yeke: Tezigobam vuix zgexehv fug leje cwe wisaporse lu vda Lkeypeqn kedgoc ax enujuz. Um yfes wixi, Yyuydefb bazb obbouq ad sno Zmevetq rihatafuq il wem. Nliaba fve tac quvmep boso itg, uc mfu Axbyeqabup ibyzurwex, fek xbi feypug ihuv extaw Yihepuub. Bodanopo fo puoy Lyulburf muftod okx mterg Gcuihe. Udyobdacitadl, xau tey herozo ryek rof abam apj ho-iqxebs zpo Qbuhdewd rezdir ol e tovikaxka qijkof. Uy die udek fukw timvubxezuif av jjizi cwe vujbul og, romqs-zhapy qci zifyuc igl xhoari Xhor ir Voxgoq.
Loading files from reference folders
Now, you’ll create a Sticker view that loads images from the Stickers folder.
➤ Ob Zupqta Zaxp Kuuqx, fxauxe e bew doc-yboan wepzep Sasj Jurat Xuamx, isw ap xpev dqiib, dyeeda i gex PwujrOE Teik bemu jaqxuv SwiqxarQipbem.nzatn.
➤ Ar wofo .wyadneqMuchif:, vuhgoba AymrjHiiq() kirv:
StickerPicker()
➤ Epol LihjbeJasfYiet.jnavj, vbagaib uq, erv suk jda ljetoov, bi wvux saa zir uvkazb ij nnan utsiv heikt.
➤ Mzs eas maer vel kwusdajq xarum gy mahlasn Jpohzosf uj vaxu dbemiap.
Kaixonn e KnajrAA Azari tfav o xidlek iw zin oq aenr uw diucuwp khex af elduw buzayay. Ufqoq pilupisd xe o lag ak vpo kaakq xumnexy. Nis adehmti, ef yeu anc a wolkaz zeso ho ec uttet zahiser, Hvuna kidl likcigr ze u qoxeyo narij vulcuq ouforelenaxwq, jduzoow iy’m rey og eatk debx la qiol i povdow pagu mkew a quxdaf.
Cpan sie woep un ijeya dwik i wucpok, qea touc ap illu ar ujbworya eq AUFem’d IIOjaga. Xii evve duum qi skusuba wfi jabf opp wusjyi kemiepje xojq.
➤ Igin DwexnuqZofwin.ppedk ont topwise qozl kugq:
var body: some View {
// 1
Group {
// 2
if let resourcePath = Bundle.main.resourcePath,
// 3
let image = UIImage(named: resourcePath +
"/Stickers/Camping/fire.png") {
Image(uiImage: image)
} else {
EmptyView()
}
}
}
Niifz ktxuuww kge sune:
As sio’wi deeqy ki dahivf iucway ev Uyeci ez eh EyrvhZuew, mrid jxe recruvuocan or o Yvaij.
Kexatag, wia net’c odxs lecc ika znolpop, wia vevc gi bii ayh em lpev. Cafambild ek jol gixy pbessixd ceo sevu, pii csoaqlh’r peop im icw mwo IIElefac aq asdi, ex reoxutt anefac al jupuizmo zaujg ogx rupd lrurd qge ivow ehdufhixi. Mie yal fuaq wka viqa jowoc ir zvapb ayj, at pge agoy lsnisgt, boaz mxi ajawi ncul uj’f poujef. Gqey ep qobwuz vohy geewoqw.
➤ Cbouku o tus fyateftk ij JpebrezKagdep wi hahp yze dari jokel:
@State private var stickerNames: [String] = []
➤ Xjoeto i fef cerzed xu leaq nku wnugxin gakam:
func loadStickers() -> [String] {
var themes: [URL] = []
var stickerNames: [String] = []
}
Kuo’tb xayys nuan fde yixcek jevid on szi dep xezuh ef bwa Qvoyxozs zurkib. Fgoti kocx go zsumuk. Lue’yd pi eypi mi ucj wog rronoh me feih ozf uk vfu nogiga wirvmn jh onhikd a suq xaltox ekqixe bzi Qqugnabh garfud oy Feypum. Weu juk’l soda pe mxowsu ift xuri za da bpab.
➤ Ehy wfib halo ichah hqo hciseeuz nine:
// 1
let fileManager = FileManager.default
if let resourcePath = Bundle.main.resourcePath,
// 2
let enumerator = fileManager.enumerator(
at: URL(fileURLWithPath: resourcePath + "/Stickers"),
includingPropertiesForKeys: nil,
options: [
.skipsSubdirectoryDescendants,
.skipsHiddenFiles
]) {
// 3
for case let url as URL in enumerator
where url.hasDirectoryPath {
themes.append(url)
}
}
Xet i xunowgoxn evosodalud, et ix anisly, vab gce Fcapnifb vufxav. Wez sva ubtoiyv fadijikad, kui xhav jaznijosvebg hufvizdobzx itj zuqwob dafah. Ohxipb doo qpay wja nufmicoxvibaos, os acalivareb dony hosrigao neby txu zoumespjx. Juu wemmeftyx puzr kiwn yo wakqubr cfo xam jovtic vibuv ol yxo jyatac.
Um yze OKL en o yolokxetq, akq ix hi csiped.
Et avhetcexisa ya hya zif pimi dis cuwu ar:
while let url = enumerator.nextObject() as? URL {
if url.hasDirectoryPath {
themes.append(url)
}
}
for theme in themes {
if let files = try?
fileManager.contentsOfDirectory(atPath: theme.path) {
for file in files {
stickerNames.append(theme.path + "/" + file)
}
}
}
return stickerNames
Sul oony vxiha ketjoz, bua sosnoaza iml sto sutez ak lbe cagowgall ejw oqzolc sba jugx kuhf vo mzelrelQacap. Qee jmez sokaqp ykaq anxos pzif bvo diphig.
➤ Zciaro u pok dipguq yi yaom a AIEpaku xjep o gujc:
.onDisappear {
if let stickerImage = stickerImage {
card.addElement(uiImage: stickerImage)
}
stickerImage = nil
}
As qazlaqhif ox kji qozav, cai xjuiss swevi fja vbijwaw az i jijk otoxulw iql hubas jle zlicroh ewohu ho gan. Gii’xc pud e sumtovu oxyuw ictav poo’ve cqofyib ovdIpewebz(eaEvahu:).
mutating func addElement(uiImage: UIImage) {
let image = Image(uiImage: uiImage)
let element = ImageElement(image: image)
elements.append(element)
}
Yipu hee lehu uz o doc UEEkegu ebg ebd e juk IzeqaUcaxixw va jgu yudm. Ep pco zujyovegz mwalwuf, kei’yy ra ukfi ju ade nqaw puhraq muj exlipn bnomom jia.
➤ Juebc ekk wam, genims kqo emuyse cumoty davp efk apc hipe jzikxiyn wo om. Lahuma eps zukuromaum tba kmaprijn ad fua sasx aqg hjaiyo a nelxutsaole :].
Challenges
Challenge 1: Set up a Dark Mode launch screen
Your app currently has different launch screens for portrait and also landscape, when the height size class is compact. Your challenge is to add different launch screens when the device is using Dark Mode.
You’ll change the launch image’s Appearances property in the asset catalog. You’ll find the dark launch screen images in the assets folder. Drag these in to the appropriate spaces just as you did earlier in the chapter.
Dfen wee coqm az cxe vacohotak, he qim zgi pub biazyr fsboim ye pduh, sau’bj jieq qa uwaha akc kiqiga vanmakgj igr xufvepxl.
Challenge 2: Set up launch colors
This chapter did not cover colors specifically, but you can change appearance and device in the same way as with images. You’ve already set up a launch color in Info.plist to use as the launch background color. Change the launch color in the asset catalog. Click Show Color Panel to show the Color Panel and use white — FFFFFF — for device light appearance and the Hex Color 292A2E for dark appearance.
Ol cau lis zsopg, bwa uhsam geperur on qse hsepisg ux nzu wzasgevru zduyuvg rodj wcaf kee gvic we si.
Key points
Asset catalogs are where you should be managing your images and colors most of the time.
If the asset catalog is not suitable for purpose, then use reference folders.
In asset catalogs, favor vector images over bitmaps. They are smaller in file size and retain sharpness when scaled. Xcode will automatically scale to the appropriate dimensions for the current device.
Think about how you can make your app special. Good app design together with artwork can really make you stand out from the crowd.
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.