8

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.

Blaszard
  • 30,954
  • 51
  • 153
  • 233

1 Answers1

17

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.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
  • 2
    Thanks, that helped a lot. The interesting part is that the [NSStatusItem](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSStatusItem_Class/index.html) documentation doesn't mention `NSStatusBarButton`. I just found info about it on the header files. – Gonzo Jan 01 '15 at 19:36
  • 7
    Thanks a lot! This is crazy. It's February 2015 and the documentation is still not updated. – Alex Feb 12 '15 at 13:39