Skip to content
Generic Mac OS X menu bar app (agent) template
Branch: master
Clone or download
Latest commit eeb8942 Jun 7, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
MenuBarApp.xcodeproj first commit basic structure Apr 24, 2017
MenuBarApp first commit basic structure Apr 24, 2017

Menu Bar app template for Mac OSX

This is a fully-working Xcode project to create a generic menu bar app (aka agent) located at the top right corner of the screen in Mac OS X.

enter image description here

The main components in this template are an AppDelegate and a .xib file containing the interface of the agent, which includes a contextual menu containing the "quit" option.

When compiled with Xcode, this project works out of the box. AppDelegate.swift contains a function called update() which can be fully customized to achieve the desired functionality of the agent (currently, it simply displays the time as a proof of concept). The function update() is triggered by the applicationDidFinishLaunching() method, where you can also specify the timeInterval in seconds between each call to the function:

Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(AppDelegate.update), userInfo: nil, repeats: true)

Feel free to use this template to create your own menu bar agent. For instance, I built a simple app to bring back the battery time left in my macbook pro since the latest update of Mac OS X removed that feature and I was missing it.

You can’t perform that action at this time.