Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to develop status bar app in OS X Yosemite?

I've been trying to develop a status bar app for Yosemite, which is my first OS X app, but when I searched for the document, the NSStatusItem documentation says that almost all of the properties and methods there (e.g. .title, .highlightMode, and .image) are deprecated in OS X 10.10.

So I wonder how I can create a status bar app for Yosemite. I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. But I know they are usually slow to update the documentation, though I wonder then how and where Dash got those seemingly updated information...

So which is the correct? And if it is deprecated, where can I find the Yosemite-style status bar development resources?

I use Xcode 6.1 Beta and Swift.

like image 912
Blaszard Avatar asked Sep 12 '14 11:09

Blaszard


1 Answers

In 10.10, NSStatusItem has a new button property which returns an instance of a new class, NSStatusBarButton inheriting from NSButton. This is what should be used instead of setting a custom view on the status item. The deprecated methods of NSStatusItem just forward on to the corresponding method of the button.

See the header files (NSStatusItem.h and NSStatusBarButton.h) for the most current and accurate documentation. The prerelease class references seem to be incomplete. There's some brief, indirect mentions of these changes in the 10.10 AppKit release notes.

like image 165
Ken Thomases Avatar answered Nov 11 '22 17:11

Ken Thomases