Build Your First MacOS App
A simple guide to start with MacOS Development
--
I’m pretty new to MacOS development, I’m coming from a past mixed between web dev and iOS (My latest app: StockPapers).
Today I want to share with you what I’ve learned day by day in this week trying to create a clone of my nodeJS cli, splash-cli.
We are going to build a status bar clock application with “reminders”, where the user will be able to schedule notifications.
We’ll see how to prevent to open the same window multiple times, notifications and so more!
What do you need?
Pretty obvious:
- Basic knowledge of the Swift language (or maybe not)
- A machine running Xcode
- Xcode 10.2 or newer (even a lower version is ok, but this will may change some methods in the code, depending on your swift version)
📌 Create a new Project
First of all, we need to create a new Xcode Project, so go under File > New > Project...
or press CMD+Shift+N
Select MacOS as platform and choose the first, option: Cococa App.
Then choose a name for the app, in this example, I’ve chosen “Advanced Clock” and make sure to check the “Use Storyboards” option.
Usually, on iOS, I’m not used to using storyboards but for
MacOS I find them really helpful.
🔧️ Project Setup
We need to setup our project before hacking the code: firstly we need to delete the default WindowController
and the relative ViewController
because we don’t need to open a window when the application starts. Then you should have something like in the screenshot below with just the Main Menu
.
PS: Don’t delete the Main Menu
, the action is not reversible and if you ever…