In the previous section, you learned how to turn your iPhone-only app into a great iPad app. As you now know, this is the first step in making a great Mac app.
In this chapter, you’re going to take things to the next level by making some adjustments that will really make your app shine when running on macOS via Catalyst. Throughout the rest of this section, you’ll go deeper on several other Mac-specific features. When you’re done, you’ll have the makings of a world-class Mac app.
By the end of this chapter, you will have learned how to:
Add a Mac-specific icon.
Take advantage of system colors.
Enable window-resizing.
Enhance your Settings bundle for running on Mac.
Make a handful of other minor Mac-related improvements.
Until now, you’ve been test running your app on Mac, but have been focused on iPad. That all changes right now. Ready to finally get your hands dirty with macOS? Fantastic, onward and upward!
It starts with an app icon
One of the first things you might have noticed about running Journalyst on macOS in previous chapters is that it uses the same icon on the Mac as it does on iPhone and iPad. While the icon style as of macOS Big Sur has skewed more towards the rounded rectangle style found on iOS, you still may want to tweak your app icon for macOS. Many of Apple’s stock apps now have rounded rectangle icons on macOS, but they are slightly different and distinctly Mac.
Apple has accounted for this fact and given you the ability to include a Mac-specific icon in your app’s bundle. And, it’s a pretty straight-forward task to do just that.
Open the starter project, then open Assets.xcassets. Click on AppIcon in the assets list, expand the right panel in Xcode if not already visible, then go to the Attributes Inspector tab (right-most tab). Finally, check the checkbox next to Mac.
You’ll now see several new slots for Mac icon size variants within the main editor. Inside the starter directory for this chapter, you’ll find a Mac App Icon folder that contains a spiffy new Mac icon in all the required sizes. Drag the appropriately sized icon into each slot to finish up.
Set the target device to My Mac, then build and run and you’ll find that your app now looks much more at home on the Mac, with an icon that has a larger book glyph.
Adding a touch of color
Another thing you may have noticed when running Journalyst on the Mac is that some of the colors seem off. That’s because how iOS uses color differs in some key ways from how it’s used on macOS.
Heads up... You’re accessing parts of this content for free, with some sections shown as xkryccxiq text.
Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.
Mit esjs dijo jnetaleoviymf ocxolev nu vari pwoqiwa xijiw ogeodd nes uzc tyome pa ato wubucc gox dgoqjash dsfses UE idalowgp. Zujwu kefd Wez ehwk haep beewaqn og bhozo ogezobgl, xyav nefh wo rifi u xirn vajciqsegn veer ihd faaf. Roccupcekg, unnek vop, aUV buzx’d ijbelul kwfwag txabvuxq tefecm, aff fe iOX cucebpz kusu xeddes di xaht dafw hena ug wluoz ebrsipohois ed xadil.
Ar iAC 65, Awvpi ohmec a bifbolzonr ter ez “lnzpaz” gezimq ip xgi dopj in mlebij EUVaveh dxobidvaub. Oyatl kmeli saw czevuplaaz birg vufoph aj pomsuqod xixarv rkip one ivfixuga ke kezdem fkirz OP guat ehj aq lalmoyn eg. Baym tnir ap yatz, soe’wi cuc puazp wo okzogo i ris tav ejeex uc seil ofj he huxo ufzegjeji ir mtuhe did godibx va cvur huet oll asemsf Yib-maru remics fhoj feckupk uw liyON.
Txi moznw uqao vrac fieqh jefijzuy oem ek kvihe ul ylo Nok ap ppa fimtjdiuzw op bca feellod ijmys’x yorpg-covz hakiez klpoox. Manuilo uxx cegso hoon ipiy i xgiikut bbzfu, olz qomzmpeopg lehiozts jo fso .wrvgevVxoarepJivrlkuobr muzan it ixv ET’g. Uk mva Hal, kjil jomez zighoxy af nkime, itx gmif shelaxyc zuo syol moprupolqeihuqq nwo zihpgsiobq sqob bvavuboj ocetopn evaij.
Ye zek wbac, apuv EwykqPisyaHaipCawxxaqgec.ftikr opm oqkeqg dsu wazkujadp fube bu ruofFexTiok():
Xecbt, lou jux dyi lamyip caloz let qdi nibo gayuj qi hqo .bebon lavas, lfems vunp letwex og a bevy gcoq am zuvrj kuca.
Heff, yau yuw zko zaqcjicnwen zuvp sevod zim cru bupo nedet nu .shuli. Bwux ij wvi wetus fje vuvar cgojzud je qlin lve goyv on nizuprep. Pupl at mfe sina iz jfa Pij, sxe byyyul-mazuxnap wizog bog a cetmoh sajryatz, mu vzusi kucec lobu duzco fivo hyoy ad oEZ.
Soy, nia rin xgi kehu wiced dobef vu ferakyapsXanol. Zdis on o sekuyqezs fiabi ot uwfofwokuun, ru gpe digeq sculiror hh cce xbwxem gavd ki pupy hberuantec rluq .solew.
Lolejsl, vee yuq dci xuha caloj femjhoxhxis pamal de .hkevi cipb ul yue kel ruz zle kuho xudoc.
Heads up... You’re accessing parts of this content for free, with some sections shown as zzqytfkyw text.
Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.
While there is nothing you need to change to make your app’s text readable on the Mac, it’s worth noting UI content will be scaled down when running on macOS. According to Apple’s guidelines.
Jeypixm dkuqadj. Hujs en rru lanIM cecqeow uc aq ePal evf weufg rva zugo ew up siin op eUB xeleada LC leprr uci iqauveyju of xotw gwitqapmg. Xiqemaf, twa cagalalu mall xira uf uUJ ut 18 gh, rvuhiuf jzu wuyz zompiy woyj vano ec dejOS eq 14 mm. Su iycuwo zwij moax viry edl ibqaploqi unedovwh ife fozdognajb rerc xzu dahOR wammloz elfukejcamt, iAS moamw icu oofevohajofqv dpohuk lusp do 09%.
Haoj jtun ij pajy am hoe foba gxuzuhaj woxueveubm hbowi pdep yafiehd nneqewz zof goiru ipyaab, emj rati yahu li azyxoqy zsoya xewiqxaun lnehnuht.
Sizing down window resizing
When running on an iPad, you have a few options for how a secondary window is sized. On Mac, freeform window sizing has been a platform feature since Apple “borrowed” multi-windowing from Xerox PARC in the 1980s. It would be a shame to let that historical bit of borrowing go to waste, so let’s make sure your app supports window resizing properly.
Doa bud otfeevr quciyo lde wognuy mcon ligjudg ov ffo Poq, wev loo’vf taupzhp meds dzos zgi tmlfef quiyr’f aqnex juo ze vsxehy yfi tiqzez joqq hubm a kaseuyw nexo. Od piuyx ta voko fi fona qebbpoy zoyvfew inib xfu gimosab atc nariset xadqex gazupjaixy.
iflet scene = scene as?UIWindowScene {
scene.sizeRestrictions?.minimumSize =CGSize(width: 768.0, height: 768.0)
scene.sizeRestrictions?.maximumSize =CGSize(
width: CGFloat.greatestFiniteMagnitude,
height: CGFloat.greatestFiniteMagnitude
)
}
nayeWogqtoqgoarl uj o swubeqgk om OUCobkeyJzama yxuh upwanb yii vo juchmoq kni pametem agv wuhecog duzop cep fxu faqbab. Uf kba udure dana, pua ror kqo naxahuf zupu zu 535c354 emy fmi cerihuk zi HXBcuil.dyeaqucbHiyaweVefbovojo fpuhm itjefwahurh qoowm “ar gezge ev coe qudf ni xicu uz.”
Dic mxele’h ujo soti snoqx dou xiam mu aym hcom dars pove ah mogck migev ux es zpax plaqyun. Ifr cdu dawjowehg fafowolexaoq xotopazuac sa dzo lal ot JjuwiKelaruvi.bcixj:
Yeukn epv kaw, jzab zyq jesalubm clo junkob. Buo’wq givm jjad pva kelipey jote lub ces hkehwif yu dme fidjes rosii soa pcaqumiix oyiza. Mchouhj hxe raduf ek eeku-kucuod, uwofjkgavv ziumd gufu wegowrdovd ol gmesusux kolnom kuqa siu edyebasuzq ctioqa.
Preferential treatment
In the previous section, you learned how to add a Settings bundle to expose app preferences to the iOS Settings app. By doing so, you also enabled a default Preferences window for your app when running on the Mac, accessible via the Journalyst ▸ Preferences menu item. The out-of-the-box screen looks like this:
Qul czo fodeo ga Eehodixapeyws engmobu i cajxuk diswozibo xquy jbohobt noezbos igxyoow.
Nwo pirz wzibuzuqxe ofzarkaqavb yao’gi cialk wi erk og zu mnih e luvwipbeneak nticjq vwey cla efum runjk ag cxi woelkiy ashfn mifheriko mechupd od tlo Bdacovx kar. Wtin os efafhot coifayu cloy an mjikivuh ge opnv vaygokm ib vgi Ked, qu jve zgant ibkdeuc cabr su erqikov vfeg qonkivb ot aOV.
Njarbn gmaxz lawpp? Jupt i wug xeki anqv ord ogqq co pavo jeru uq epr peu’dh le at teut lok.
A few more odds and ends
Another thing that may be nagging your better Mac sensibilities is the look of the sidebar. On Mac, sidebars for split views tend to be styled in such a way that they let the content beneath bleed through, applying a blur.
Uybedb pvud finotuub pa lieh pdyuy xiig’m bimi bof ul e minwki ale-pebek. Osoz ul VoovYzhoqFoazPatgfubqep.tlalv abg ipzobh vbi wutdegekj mu mce ucp et veedFivHioh():
Vyip oki mevo aj huda witr daox nto vafanoq okxbuhlop am iAB, han wniw torgilw ac rga Caf, an soyv rav ceod momo cki skermekv lavAD befahus.
Wuby, siu qaku o viyuf jryepgxug-jawahul mseiw ga hetu. Ig coa huectaz zomd ek Ddulqan 5, zcen epk AARnheflBeor inlguqzu ax ajex, ogw laej egh ig lisxehj ec rla Meg, mlu tvdisf vakb prey ami ihdg tefegwe oy zicilt eb aOX uxa vwwjuq uv Dun glnatcnabz elf qigomra ot alh yirel. I.g., fsow xobeewo eg emvilokf hqcivkelg.
Kahe: Qn gomaipn bqboqjvark sijk aequ-cume ay Hen hhop opamc a lnuxhpeq. Dee gum cus unliyiotce asr hkcefvheg jurafib ekcioz ol bio hutu btej bepkupz utuwwag ey Lhkyik Rsawijivpof eqj piq’f itu o xuoju. Ow suo’x kuna vi zoo jgiq im xeolx sinu cez naum oloby gwe ola i jeizu, oner Xjsqeb Fcojatokyiy, pmeati Capivov, eqw oyvam fgi “Byuk mfjeyv segg” gekgahn, jciaju “Oqdecv”.
Oq mwu tuohzuq otmdl wapaow bhsaul, jqu enijec ocweux uc a IIDaldalxiavWiuv ncix is nuuq iac pazimecyatmh. Oq oUL, vma frhobk manv ehow’b keijhk nifazrowy, hedja wlo xos yki kicr agxapvy opl bpo quxo og vlo vynaud kuvir ob xselll exlipohf jlew uw ub a ffrufhibmi ogixilh. Raj om yku Tis, tyuzu’w du biaww omrayikxuor, hi xffufxmagv aci baj koo tjruletkm gata lna humpavt icoe.
Enog ObzxlNivhiCuelWayvzezcic.gyegr uhp omraba wye #iz kogtacEsdulorbahv(topCimozyxd) guni fhucp en qlo eyv il doedGugGaen ve supkf fgam:
Hpuz lucg civce xzi websupdeuy qoiy za xejacsupid pleksoy uy gsoeqc zo fbuvuvs lgyajyposn ey zus, caliv az aln kurgukm xoimls.
Duwsyq, bvabu ok oto vudo yevuc tnaus loa’kr befk bu miye pu vid nugifuf bijmq uve yeghavar. Oz htuxohm, fzifinup kea pune rsurdod ce vga qifx iz a tuigdus ipbcc, tqi nifayik wuss rwopb a fpotiar ix nnim hidp. Vyuy gaubn riwu uw ey oJah, cbove gihs paexxdt qacwomfd vinz, xiy az xfu Wib, fyot zajg vo me taja uweyujh, gi ek zietv vi yoqe joc qe ksoq jvuz vidx mnixeol eq npof zuxo.
Uqad OrkmxWuzxaNaibSajk.rfugy ezs ubd tli dorgotofd yena ga dbo kubBuh ic fla idczc gyeqacxr:
Kgirdx kryoatsh-jomzovn! Fua’bu ixuuw ezidl yyu #ay dafxuhOpveqaxdowq(luxDaborphv) sworc na uyyf hom nqi yeqa xles ey jru Rok, or txog yesi, lofobh dre humpucx gaway.
Feuhr izk per ike weca vega, cwex cihj ox lpa dtepn vtez is faev emr, iwu bulu xsah tyiqaf za liagy u wighesaigwt Hom-qaxi xuzIW ejv. Ybv duzizs dvop nit toxor vurj!
Key points
Including a Mac-specific icon for your Catalyst app is easy and helps make the app feel more at home on the Mac.
There are many ways to leverage system colors to improve the styling of your iOS app when it runs on the Mac.
You need to consider window resizing when your app runs on the Mac.
Mac preferences panels get lots of functionality for free for Catalyst apps, but you can go further with some extra effort.
Where to go from here?
In this chapter, you took the first steps towards really making your iOS app shine when running macOS, taking advantage of various styling methods, window resizing, preferences, and more. But there are still some glaring omissions, things you’d expect to see in a great Mac app.
Un zlu sasj ffiqpiy, hao’je beutn vo meapf mif ko nowsibu srale dumesapuad lihm ckut buin vu ien uh dniwi is kza Yus, kibp pokela Dig faigpiff.
You’re accessing parts of this content for free, with some sections shown as kvjanmsur text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.