Creating a macOS Statusbar Application

  • A device that is capable of running macOS Big Sur
  • Xcode (I am using Version 13.2.1 (13C100))

Create Project

  • Open Xcode and create new project.
  • Select App under macOS platform
  • Enter your product name (Statusbar)
  • Select Team if you have one or let Xcode generate one (My developer account)
  • Enter an organization identifier (Reverse domain — dev.gokhun)
  • Select SwiftUI as interface and Swift as language
  • Uncheck core data and tests for now

Add Statusbar

In order to add statusbar and menu items we need to add NSApplicationDelegate to our application.

Open Windows

In order to make our statusbar application more useful let’s open some windows from statusbar items programmatically. We will create NSWindow instances by clicking statusbar menu items. In these windows we will use SwiftUI elements.

  • We have used an adapter to add AppKit to our SwiftUI application.
  • We have used another adapter to call SwiftUI view from AppKit NSWindow.
  • We have set application target property to run it in background



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store