Skip to content

Instantly share code, notes, and snippets.

@artemnovichkov
Created January 26, 2017 07:26
Show Gist options
  • Save artemnovichkov/de92b678ec9ef336b78b18efaba353e0 to your computer and use it in GitHub Desktop.
Save artemnovichkov/de92b678ec9ef336b78b18efaba353e0 to your computer and use it in GitHub Desktop.
NSViewController category for simple initialization from storyboard/nib.
import AppKit
extension NSViewController {
static func load<T>() -> T where T: NSViewController {
return T(nibName: T.className(), bundle: nil)!
}
}
//Usage:
//let viewController: LoginViewController = .load()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment