Preferences Window Controller For macOS
It's really easy, just setup the prefs window controller, and then add VC that confirm to PrefsWindowControllerProtocol to it.
-
VC Setup
Just implementate 3 required methods:
class VC1: NSViewController, PrefsWindowControllerProtocol {
func preferencesIdentifier() -> String {
return "VC1"
}
func preferencesTitle() -> String {
return "VC1"
}
func preferencesIcon() -> NSImage {
return NSImage(named: NSImageNameAdvanced)!
}
}
- Prefs Setup
let prefs = PrefsWindowController()
prefs.viewControllers = [VC1(),VC2()]
- Show Prefs
prefs.showPreferencesWindow()
- Hide Prefs
prefs.dismissPreferencesWindow()