Developing macOS apps

Hello Jens,

MacOS developer here. I’m still quite a beginner (I have only posted one app on the App Store so far), but I believe I can share my basic experience.

The way I like to think about developing for macOS is that it is a slightly more context specific way of developing for iOS. For instance, instead of the UI pushing to the edges of the screen as it does in iOS, macOS tries to squeeze your app as tightly as it can, so you have to include the necessary .frame() restrictions and .padding(). Additionally, you have to consider the macOS Menu Bar. The glorious thing about coding with Swift and SwiftUI is that many of the frameworks transfer easily across these different platforms (so if you learn iOS development, most of your skills will be relevant in macOS development). I completed the whole Launch Your First App (LYFA) CWC+ program following which I invested some time in learning how to develop for macOS. After creating the iOS version of my app for the LYFA program, I simply added macOS support in Xcode and went through step-by-step, fixing the minor issues and adding code here and there.

Now here’s the trick: to make a line of code run only on macOS, simply write,
#if os(macOS)
//Code here...
#endif
This works for restricting support to other Apple platforms as well.

So, my suggestion would be to complete the CWC+ LYFA program first (I would say 98% of the topics are applicable cross-platform), and then divulge into the world of macOS. CWC is not the only way to learn Swift, but from my experience, it certainly works!

I would love to help you out if you have any more questions!

Have a wonderful day.

All the best,
-Michael