Skip to content

Instantly share code, notes, and snippets.

@n3tr
Last active October 30, 2016 15:27
Show Gist options
  • Save n3tr/fed204fdaace2917dc588c5efdf6722e to your computer and use it in GitHub Desktop.
Save n3tr/fed204fdaace2917dc588c5efdf6722e to your computer and use it in GitHub Desktop.
WindowController.swift
fileprivate extension NSTouchBarCustomizationIdentifier {
static let windowBar = NSTouchBarCustomizationIdentifier("com.n3tr.countertouchbar.touchbar")
}
fileprivate extension NSTouchBarItemIdentifier {
static let label = NSTouchBarItemIdentifier("com.n3tr.countertouchbar.label")
}
class WindowController: NSWindowController {
// ...
}
class WindowController: NSWindowController {
// ..
override func makeTouchBar() -> NSTouchBar? {
let touchBar = NSTouchBar()
touchBar.delegate = self
touchBar.customizationIdentifier = .touchBar
touchBar.defaultItemIdentifiers = [.label]
return touchBar
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment