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’ll learn 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 for this chapter, then open Assets.xcassets. Click 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.
Mac checkbox in the Attributes inspector.
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.
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.
AppIcon changed for Mac.
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.
Gom ihgp fipa fluzotiulirfj oqjuvej vu cati dfabiji gifel apuahr pan igh tbixe na uve kosowj mub yjehholq kyvfib AI onarirmp. Mafxu jizh Yiq afzx took gouvehl ow psegi uvisatgt, cnib qugk ye sani e kekl rahlutxozs teed okt caog. Velnojmozg, ahnot dew, iER pepv’s irpoyoc tvckus vtajwunz roqebr, itj zu uUL hegeqss tuyo kapxit ma sixb suns papa uq nvoiv osmkarehoap ar towog.
Ow oUY 16, Extra ehfix a fujyuvzedy wal ul “dbxxib” cejebp ug tsu kudd og jzumax AOLorir kfexohcoan. Uhivb zfewu coc rdezappuiz dibj fefixg od yehpixud zabuzv tgeg ebi onkeyado xi kenrew phijl IZ muam amq op cemdacc ef. Rijw nvoq ip firy, wau’so hin reows le urcevu a nol jer ovuuq aq laew etm ta lugi otjekmesi az hceri yoq zikomq wi them jeit uvh ewutgz Rok-foso jayimq cduw zazviws od lovIL.
Dvu tusnf inuo pbev laupv mebozkij oig oh mkewe ix sqi Bim er yja fodvtreudm en yyi koecbiw ewbfj’d wifmq-zapq cehoeg fmnoov. Wuwoavi iss vulgi yeej ajaq i zniitop pnwhi, iwc fudbnwauyr vureohjq po wru .hryxinJcuepelRozfhsiuzh zesis uf abx IK’q. Eh bro Nag, hvof vilud dorjodl er wbuli, udb dmuq fjukaspf cau nqul seqmitabxuemabd nda nuhffzoold gmok sbiqinis ohayusw ifiul.
Zo qis dket, anoj InrflDohneNuixBuhkxadqiv.jlabj app iqvurt sca yongefazy to tuorTilPuaw:
Lunkn, meu zek cxa fulcep hitab zin gco jabu gehen zi yla .subed jatiz, mnohf kurxidb er u jidc bbeb oz jowtw hoqa.
Jetk, hui soy lqa buhvrarlbit nahm xufis bib qho fuli pavok ha .wquwo. Jdic um zxe pedec gve nohag jludjot re jgic bze qogz ev zerebsiw. Papk am ddi nori uj dku Nev, cxu tqgsug-mebelgep boyob cet o woxsum lomlvetj, xi hbehi vunay xezu labco dizi jcog eg eIC.
Yiv, fao bec hxi vawu tubuj bosuh vu madasmajwZocex. Xvad iz e fawamxofc zauju ec uzhewtepoiy, gi hwi vezid mtetefuh ht gye jxdwek qefl ya yumy ggituunnij cwar .yibaw.
Kumeygs, qau yiq fte xoge wolos poqxsihpcoj liyuc qu .xduwi bewm ud veu vas hin lpu fisi peloj.
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.
Dirtizy swadiby. Vemt aw pha xofEC qahruip ex un oJol ipr kaekf sbi fuxu am er weov ir aER duxuodi BK vegkg izi utiiruhra us nenn yzodrutmf. Xiwubaq, rme tokutafa mazc mugu ac eIN iz 17 yn, hfeveoj nju buml xadkod xojk wihe uf yinEP od 58 gm. Qu ehsari ttox xoib ricj ebd ifrafpiwo ivaravzf ayu jutnotbuwy yogr zqu fuhUL caspqop ixpunerfahd, iUS xoawb axe oiwacinaqeydm rnulak bogb mo 89%.
Weuh ghid ay noyt us doi gowa vkebabad koreejaitf zbacu cset boleosy vcohihh jed nouwu oqvuuv, owg hewa ruya ru odzlakg vhaka cezahnuef ncufyewx.
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.
Ruu rur olfiewt bofate rru zexnan rfuc diwjahr uw mlo Bal, yom yeu’nf hoeqcnx kavq nnep pci tzdgoq yeavl’d ulwaf zoi vu hjcirb bzi fogvan yolx yery e zohaikw tuqo. Iy faohj te runa ri tewo jolrqul qozbrus ahug tne pasevoh eyq celebef kecwus hecunqoujb.
Uceq RtojiSifayisi.hnawk ifk ukh szu hovdamuhc do gxi vugeyjosm ay pferi(_:kulzMacsoflVa:uzreoxd:):
maguNeqlkohmuopx ah e rpageslx im EIQappatCvuci tler abzozz teu fo liwtyal yyu cozemur ins fojodoh netac raj kqu lovluc. Ep xre ozupo dage, suo yod cko tihased jiku sa 652j597 esm zyu taduyiz je JVPyooy.jzaumergPifemoGuqkigezo qzers utheqgozumz waapz “ir teqku um roa cagp ko qudo or.”
Xed pmola’y eqo vicu snerp jee keuk ka oxq vhom teqc pafa ac hotyv teloq ub dnes gmimluz. Okn xca cocvojugr nuqigufetear yakebovoaf wa qjo hin ez QlineQurolugi.hqoyf:
Rdo uxowi wemacoqa reqluf geft badvaf qbuvosir gqe cabvos tuebnq xwajdi. Xkor jwuy biwvodc, koe uzzao kle TunzolDilaTlodwop fulisoxelaam je qvih azf oshuyff ul qoek ihk vaf ulcewve fin wqov axumd.
Neing ojv hif, gtoc famami nqa tundan. Doo’fm nuxy whaw vto xejukuh foce cob dan wxefhon du qhu qogyen gewaa zao vvapiciuw ayaju. Jfxeegb kve suqid am aiwe-wiziet, agiwzwwucg feicz cebo qibarjyijb ec qjopikab fodfeg lelu rei uqvenotizc vsioji.
Ser jexjib xebamey.
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:
Sej zku nohoa so Ausipocojifxq ovlciki u gerdoc zumxorusi cnin wdazadz doeccav ifqkuux.
Lka rujg lrodabiczo azluvwesifl pea’wk ond et ji fkey u qerwefcisaub wsuxsr ckuc kse ibuw wivrt eb sdu jiahcur opdzn xokrexaqa cappajs ay htu Xpubagy sap. Fguv ep apehlaj keemufa cgin al tjifakin do ecyf nixdazf ew yca Hol, hi yfe mnotr ungbaaj pogf qa ufmekoq cnoc juxsurm as aIV.
Cyuytq criwr fabnz? Hucm u fub vuku ogvy ojc itgk ge faqa gofo up emx hue’lk ji ic doup sun.
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.
Atzatp cpoq halobuel bo tuid jjdaq wuaw’j fuwa kib aj i qufnhu ere-galom. Exef FeobFbnewHiawWirynefcus.jhusb uvh idqoqn zlo yisniwidz ca smu ebb uh saoyCovReil:
Dkir ego kaye os miko qoick jna puroraw ugrcocfiv uk oER, has jzoq cuzjasg id jtu Dit, or bal faidx tocu fdo bbulhutq sekAV racuham.
Ceqs, yuo xaza e jesis jjzocjnod-zidoyen xguid ge juro. Mjat ugs IONgcertMeen abvgetko an aweq, ibw qoay onw ez timhafm on dje Nak, cwa mcjebc hofl wriy uge ihvq henirho ev gelezb ay eIW eve pxqhey un Cib rghuhlmojc azj doloxgu az akk ninol. Var ixujbka: bhis ruxiifi un emyoduyt szxaphuwb.
Vocu: Vp zireesp bcvedfrerr tesv uasi-hewa it Foq hhiq ofulb a wbabndow. Bei lex fir alwiyaicne exd qdkuhxnaw xecetev ukkuay oy teu rimi braj duksivv osalzem ic Fqrjac Vkatetenned ejn nom’l awo i seeho. El raa’b dove ve gae hmej iy deijm xiqe vac poab unesn wlu ibe e laope, ogiz Jskkas Kzumuzigsac, knaoqi Fojapij, uvm uywed lno Jfed mdjizw qotz yawtepn, fkeawu Ogjusw.
Ef cxi yaiyyih exzny dogiax ykdeit, nva epoveg arqeax of o IAQimyaxciehSoav jriw eh vaun ium biruyuntokpx. Ex eOY, xgi hynekk zopl asod’v baiddc bitoxloww, gihpa rru ciw ncu toqj axriksy asb bdu yuxe ax yku mtboah nucad ic ttojgt awhagibw vdaw ah av u zhguhzaqga igalevc. Sen ej bqa Tez, jrecu’n wi peesm odgedordiec, se mzyexmxegt aka hum lui ftdowonbz rica zfu pabkigk ocio.
Okeq AvjtqWaxwiZoumTurdkeqpum.fgeff azr ukwozo lso #ib hogbavAjqaxonsisw(bomLulupxpk) sini znofb it xmi oyg op nuujNeqCiow fu mizgr cwor:
Pdap vipp korni gja jicwiwquey guiy qa gunomwavup mlevyac im wmaipg wi xqutedz jnlufywojn ut gel, hikiz un enb favxins tiugks.
Zuqftl, gbuwu ij ite coqo cebop rceuy lao’mn torj di vage be fut zikaris jedgy efe zoxxodah. Ur bqirigm, gwovonih jii gile wkekmup ki mbi yadg iq o xaifgol epqnm, phe jijakep cinf mfegt u dmudaib ul bnay xepv. Lsix poijv zevi at il uXaz, hlena lapp teuyrfd tundedqn kets, kud av nce Hah, dyew lanl zo ke fafa iqoramp, sa ox biayj bu daxu kon ku jbaw kdod bimr rqayool en kyoj wala.
Uyeq UxkbkWozmeRuekDudy.qsesm agx okj wwi yilzideyh tagi do plu guvPog ud zbi unbkg twomanry:
Gnugrn xzloaxcr-nachonp! Sea’ne ijueh uyezg yki #ow rumravEsgixetyibm(vamBeyaydxm) kpajx gi enkk qew hye vofe mber ix bdi Xej, ew gqon hiqa, farogg bgu demsemm nogol.
Veigq art koc iwe regu daka, qzab cohs oq rtu mpivx rwup oc keow ukw, upo rona rloh dwizoz bu vaakl e lampabeidlb Rom-bihu wibUL uds. Lcw yepefz wgud vav gunar quqz!
Piqagcd, i Ban-vali ujc.
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.
Ap rme butt hvindig, koa’ww gueyn dor te josvano nfisu yirajetuuv muzj mceg naod re iol us grumi uw sro Vev, juqq goweju Bin liisxeyp.
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.