How To Make A macOS Menu Bar App

No Coding Experience Needed! — Powered by XCode 12 and Swift 5.3

Charlie Levine
Mar 3 · 4 min read
Photo by T. Q. on Unsplash — Edited by Author

I love macOS menu bar apps. They are minimalistic, hands-off, and sit nice and pretty at the top of my laptop. Here’s what they look like. Do you see the sun icon on the left? That’s the one I made myself with no prior experience writing Swift.

Screenshot by Author

Without further ado, let’s begin.

If you don’t have XCode installed, grab it from the App Store. Once you open it, click Create a new Xcode project.

Screenshot by Author

Then, select App under macOS.

Screenshot by Author

Fill out the information on the next page as you see here. Your product name, team, and organization identifier should be different than mine. Everything else should be the same.

Screenshot by Author

On the next page, choose where to save your project.

First, you need to find an icon. You can find a free one here.

I chose to crop mine so that the icon filled the entire space of the image.

https://www.iconfinder.com/search/?q=weather&price=free — Edited by Author

I named it Weather.png, but name yours whatever makes sense for your icon. Then drag your icon to the Assets.xcassets folder of your XCode project.

Screenshot by Author

Your project has two folders: {Your Project Folder} and Products. All the files you will work with will be in your project folder. Mine is called WeatherApp — yours will be different.

Screenshot by Author

Select your project folder, click “ ⌘ + N” and select Swift File. Name it StatusBarController, and hit Create.

Screenshot by Author

In StatusBarController.swift, add the following code. Change “Weather” to the name of your icon.

Change the code in AppDelegate.swift to the following.

In Info.plist, you need to add a new item to disable your application's dock icon. Hover over the last item in the list and click the plus icon.

Screenshot by Author

Then set its property to Application is agent (UIElement) and its value to YES.

Screenshot by Author

Click ▶ to build your app.

Screenshot by Author

You should see your icon in your menu bar that displays a popup saying “Hello, World!” when you click on it.

Screenshot by Author

EDIT: I uploaded the code to a GitHub repository for those interested. Thank you Dan Waylonis for your comment, which enticed me to do so.

https://github.com/charlielevine/MacOSMenuBarWeatherApp

Continuing with this project, I plan on actually displaying the weather in the popup. But for now, I wanted to help you get started so that you can create your own menu bar app.

I would love to get your feedback in the comments! 💬

Please consider following me here on Medium (Charlie Levine) for daily programming and technology-related articles if you enjoyed this guide.

Mac O’Clock

The best stories for Apple owners and enthusiasts

Charlie Levine

Written by

😴📲 Co-Founder of Lazy Texts LLC. 🟨 ⬛️ UCF Alumni. 🤓👨🏻‍💻 B.S. Computer Science. Website: https://charlielevine.dev.

Mac O’Clock

The best stories for Apple owners and enthusiasts

Charlie Levine

Written by

😴📲 Co-Founder of Lazy Texts LLC. 🟨 ⬛️ UCF Alumni. 🤓👨🏻‍💻 B.S. Computer Science. Website: https://charlielevine.dev.

Mac O’Clock

The best stories for Apple owners and enthusiasts

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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