Skip to content

Instantly share code, notes, and snippets.

/touchBar.swift Secret

Created February 13, 2017 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1f8ad96ebcfb4ecfa489ee56ce6df1f6 to your computer and use it in GitHub Desktop.
Save anonymous/1f8ad96ebcfb4ecfa489ee56ce6df1f6 to your computer and use it in GitHub Desktop.
Test for touchBar... (no idea if it works)
@available(OSX 10.12.2, *)
extension ViewController: NSTouchBarDelegate {
override func makeTouchBar() -> NSTouchBar? {
let touchBar = NSTouchBar()
// return touchBar info
print(touchBar) // if nothing returns no touchBar available?
return touchBar
}
}
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(aNotification: NSNotification) {
if #available(OSX 10.12.2, *) {
ViewController().makeTouchBar()
} else {
// Fallback on earlier versions
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment