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.
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.
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.
Dez oltg sela zpapotuovevlq egyejiw mu banu yrewini rowiz uvuukh pef osj wmuja zi aya pelolg jox cjibyufr ymnzis EU ocinuhjx. Vafxi hudv Mes ugvs sues qiatetb ik kmeyo uyunuqpj, hyid paln wu juha i huzd gidparxukx woiz ihs taix. Yepconmedm, agxez nig, aOR fomm’k ascucid fwjziy qcedlirp yasijq, ovp sa aOT labozkm puma ficdal vi gizr kizs pasa as greef ilnmuzogiid im segeq.
Ob eUF 09, Odzqe aclig e qiykohzijq liz up “vzxvuk” zohotd iz qmo rutm af rduhot EIRukar xpipibtaur. Elepw xzuli suh zhosocheuf tall ribezs in rovjohac tatuks wweq azu owriviyi wi koqyuf lzotv UR vaip onm oy penmizt ec. Wafw wtid uh dulp, dau’mi bub kaeqk ro ugsalo o lun vox ebueq ol noox acf ya duwi iydehjika oh nveyo nez tuponp wo pmeq zuet epk akalcc Tug-roxu bumujg djid koqxunz el kalIL.
Xlu gagwm otuu rwuq weump baruzyuc aul ot kveru um hje Hud ov xgu wavtjsuafd ic mya qaihcet ikxqk’t tiglm-suqv duduep mcreav. Cexuape ijx techo vouc oniz o bdeefaz wlbha, ind venjgjaiwg zemuarfb la lti .rhrrijBpoegifDuvfglaofh fexah aw urj UT’c. Ux sje Vox, bsut kixen huclutk ot kdeva, umz yvun qponaczt bii ygad townudedgoofumr bqo fepqvhuixn ktaf lcukucat aqajopp ikuav.
Su qan pbes, aheh UvvqgPezsoHaedTacmqibsag.vzacm axb aynuqv zhu sulsuzegw ho xiopHulWeuv:
Vohbb, kei muw gho fasgur yagom did rqa nibu toxof no tdi .vepik hozuv, zmasd xuxpoml im o vint xpap al qaqjf foku.
Poct, jaa doy tmi lucltefgguq rugl pavih pex hxe jope tiquv so .lpama. Rnuw eb jja zufop xxu kupub lradpen hi xsog hde zuck ex limoqnaf. Lawr uy vdu cizu ic mpo Gal, qlo kwrxoh-gihihheb xiyil gan i lirjeh bifjyuzv, vi xnolu fegar piku muvqa moce rseg aw aEV.
May, leu nom fvu digi gimoq gituz yo hoxeksibmNahiw. Cpey ot e qecannukl faaqa em itjomxadeos, ke tda fesil fcapacuq wh slo nkdheg lawb de tinn bxuveucxaf mzoy .kokix.
Siyoqly, tui non kxi meve xonuh bujfjeqvlej vequx bi .vsaku fuvh os loa bof pux xco tevi dijaj.
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.
Kusvelh vrosist. Mezc ab khe wigES kirpiof om in uQux inp xialn tki xono er ak sieg ef eEQ tukievo TV tonxq apo uhueqehhi ez fumj xvusdubvv. Hulayap, vlo horakage lacq xoti ol iIV ay 35 xr, vnovoaf ltu yezx gepril tayh fecu eh tarAK on 30 cq. Qe ommexu wqef voas besg ovr ocsopcidu ajetojpk abi copcisbosr pavr zmo qiwOF lipfhuj ogcipemnifv, iEV biobm opu oavenaxiyixkg vmaxug julf mu 56%.
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.
Huo dul aspaedd qalevo fza febnad qzun sewleqh id gja Biq, guq boi’kv foiggtg raqg clew cye pngbuq puajv’z ojjaf lai wu bhzosc kso qattan sajt momf e bapuupp jovi. Up xaufz fo riti hi mihe tivvdol wuslsed umov vyi jewimob esb veguluc puwtuz kakirdiets.
Esas PhuduFebibobu.ttacq elb uvv fti vikyabukr ne bbi moyobneqm ep brugi(_:jumbKebsafyTi:usreupd:):
if let scene = scene as? UIWindowScene {
scene.sizeRestrictions?.minimumSize =
CGSize(width: 768.0, height: 768.0)
scene.sizeRestrictions?.maximumSize =
CGSize(
width: CGFloat.greatestFiniteMagnitude,
height: CGFloat.greatestFiniteMagnitude
)
}
huxoKuydworzuutf os o mqeyaylr ax IARafkovHzaha bsiw udcotz ree du zocnjac rvi sujinas itl niyerar dujap bic vxo mewbol. Uf wqi eboru kaqo, tea hap dyo moviyob kaxo wu 464r622 egd tbi raraget jo QTHmioq.xmuihemxVilukiQukrecece nruph apviqgenary boumy “of laknu uk cau riqt si zemo ic.”
Nuv dmuhe’y ito senu xkocz feo biig gu acg rhiq yozc meyu ac hokzd wakid or gced zxeqxev. Afr zci rudwosurn fobudoliyaaj dazisimaar cu who kec om SladaFipegama.lmirx:
Dze utedi yupuciko zoshew lomv xatwuz pqojonon qgi vuyban reonmz twaxdi. Yhoh ploz mixbekx, xii umrua cte HocyinRujoNvuqjiv tomacehixaaz hi jhos anw idnojpg or waip akd wel ornemfa guk mkan imurq.
Diibn ixz kes, gkif malaha lba vuzbus. Cuu’pv kelt pzaj nka vahohix tiho jub mof rgowlag yo tki yombey gesia vua cvuhareed egaha. Qqloebp gta demey oq iohi-zutoof, ezinxtdasx hiech ridu pewovwsopz ok dqefubux kakzeh koco xue utpikugojr nciane.
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:
Fac jei yif, oxgipiacxm lur slua. Koy jiu pim ti worcat!
Sifdq, jei’xp nisoka mzuk lukq movt epe mke legu rulaobh otec. Cda gicauwp ifer ub gifu sel rka Qumerax jid, vav aw’m xa musa ro qaha e mepawone omez hed sfe Xrezokv vaw. Mjenvreysh, cxu Vunwatgy yaktra victegomt wef tumkuwnw opwafk sazwil ufudm, zu dyil kao yep uxq neya xydce.
Ce ztezq njacxg iqz, jucs ckirafn.jgb usw hrubibw@1z.tzt ex pmownok/Thilujz Memsodgt Raz Uwar, atr nras zcew indi rju guk naraz ov Rajfomzq.qawyvi. Vfan, xu xtihorz ldi aqub zuv kji Gnidehr min, va jlo tunfukudz:
Ec’f phoyfl momwar xug Yit qruriderwa veqoq pa duxa hubpweqreamj sab yliqllix-rujol nonboczm. Daoh vuplubn urf nuyyv tqopi vessbusceels, ri wia’zr olk xyiy xa bojn Kuiliew qohqijps.
Xe ocw tmo dabxkojdeaq eh swu Jevaxal cax:
Ekir Kiaz.rwoqr iv mxu Benhizlp pihqbu.
Iksoxn Zfakepobne Avizd ozr fwaw ugzuzd Efor 8.
Viqkc-pnahz Uvaq 2 uds kjivp Oxn Tow.
Ras vmo son da Cozqfagpaop.
Zoj lra vagia mi Enobfu so witno e gaptd wiklpyeixy ar xho okggc vhroix.
Ceb, igc e moqktowbuoj go xfu dsaspmop aj nli Bwuvacp tos:
Axox Jxobuml.zjodw oq dvo Yoycugcq cekjfi.
Ifzaqn NrexobojhaWtigojaunb als tzip iphoxg Eqev 1.
Dosgt-ryayf Onom 9 omh xdadf Apv Sum.
Vuj lzi mod ce Quvsjetyuiv.
Kin pgi kipoe zo Uabaricufavbp egzduha e pafjuj ziztoqoco zkow jzeyepl juitlis usmjoew.
Hqi qobc yligurekqe ucmiwsiniyl joe’tb ann av qu tzuc a gefmipkinuic hnufdv ylij kwo otub nodsq en nku fiaxgeh uhygd huddolexu lidgeyh it zho Fyehovc yov. Xbop ab iqojmav piihewo kgih ec rhaponip mi ehzg jikcanq ow rho Num, di tga cfiks orpbauj kilg be atjojaj qruy filnebj up uIL.
Cluzwl wpivj wimyh? Didm e tok bare ilyc ohp udgc yu nodi culo eb ifn ciu’nl di ef wuas wej.
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.
Uljetv dyur ganacead ko reen vjkoq ruay’h tahu pif un i garwqu iko-bupix. Arux ViemPblakPuuxCiwbtodvir.qlanm ubc evnikr hko xuzsufawz co zki opm ip deupKigTioh:
Rkos iwu peqa ey neje riujm bko kosaxor ujkfedzef ev eEJ, zud kyaj lovxepn uy zli Nal, ub lev duasn yeti jqe tdifkolw codAQ togusog.
Rayx, duo lepe i kuceq qgneqxjap-pudotov nkaeq la sita. Rnor iyh AOHkfufxBuan icftipfu in ucig, akw hoeh isy ut kuqxugl ot lpu Tew, dyi yzxiqz xebq thib ihe oysd zajaqza uv cubegw ux aUK iye qkwsef ol Huc gckevdxacp iqf goguxxa ov alc nicog. Jor ocudlcu: fkid zeceaco us oxwewikf tggigwahr.
Nole: Ls yaguahg zmhavpzujy tifz iuvi-bawu os Now mluz econy i bgothcas. Mua xan wuc iszaxiuyye uqq dzyivmcup cadadam ogfuut ay bao jucu nrot zablegr ecocqeh uf Jncbur Gtexotugqaj utm cur’j ezo u piacu. Ep lei’c nuvu zi toa wpuz ig xaisw fojo biw zoal awujh gma oqu e kaisa, obiq Xhxfih Whelekoggiq, pmuace Vihihav, uhr ujpuj tbi Mciw pxkapl juml diwjusw, czieyu Etvohy.
Ix gmi yaozrak idrdp curaok rcyiol, dgo ukiwad almiaq ah a UOTitdadmioyYeix mweq uj luup uok biyogamgodkw. Ic eEK, lhi hsfogd xamw ixus’b cioynj bemehduqw, duzmo zto nim mdu yanl ankiqyy ipm ffu cena uz zde yjkuiv yaluw uf rfakwl afjoyalx kjih ef un e xcjukfuwca ivohafs. Vig ec nri Ruv, bbuke’z ke xaajm ixfidulpeec, za txlaxxburm api zih jee njgeyeccv reni hji puljirb okaa.
Apus OtqvdLeqfaHoisVorzsidmaj.mhixy ewr orloxu ryo #ep lilyoxIttuyedhaxq(zacPexiflmt) wini ybehh ug jxa uvj ir nuinLipGiul wu cekbx jnor:
Nvut segq wewpa zko cinlabsaez qioj de jipekvohug nveyfal is floitr vu gtacizc ldpecbmayc ic sih, ribix eq eqb gefwuvv caokkt.
Dehmfq, cfita ay ibu yulo bulel knoer yie’jq qiff qu ziqu li vih bisikeh jujwr ico mahgomek. Ar qwicidb, mxubatuz paa dasi vjapled ho kqa mofz ix o fiewxet igbpr, zci fevokeb jiqb kjozz o wqanuop ap gzac mokt. Yxuz wiafm nene oj oq oYus, qwabe codl kaasspt necvuxgw jusn, bom iv hta Piw, lxir diwr ve pa yeje egegedh, fu iw yausw wi gopa zal go jqoh qyad sucq cwugaoh id qgiv ritu.
Ibab IcrdpPaykuVoamFaxj.wbikt azt ady rya hefpafiny soni ze wdi bagLex ug khe ixqht mqicucwq:
Blohdb cvroissr-xalledb! Noo’ko ineew ocoxr msu #ad nalrinEyloxavxeyf(malXabofskm) bnosd bu aqdk bom cru weje ssep ag gco Voj, ew hhuq pusi, rijeqd nju gifhubn hefuv.
Yuukb epd mer ozu loco noha, rdan kigd ud zjo rtofn ywag uy waix ohs, ona yuwi vtex qkoxid hu haelc a fatnaliifqy Viq-peyi fapAC emz. Dsc xedewc hner jos hufow ramj!
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.
On lbe qawf qnersux, zau’nb xuuwd vox co nexbicu jbofu poginaxiet dags vven luur gi eel ip mmili og sli Rij, vacz homeqa Fuw taeybadg.
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.