Skip to content

Instantly share code, notes, and snippets.

@aral
Last active July 31, 2018 20:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aral/84ddf7ac37be079632ab to your computer and use it in GitHub Desktop.
Save aral/84ddf7ac37be079632ab to your computer and use it in GitHub Desktop.
NSPopover .appearance property is NSAppearance in Swift, not NSPopoverAppearance as per the docs
// The docs say that the appearance property of an NSPopover should be set to an
// NSPopoverAppearance enum but it actually expects an NSAppearance instance.
// e.g., in an NSViewController subclass:
let popover = NSPopover()
popover.contentViewController = self.storyboard?.instantiateControllerWithIdentifier("someViewController") as? NSViewController
popover.appearance = NSAppearance(named: NSAppearanceNameVibrantLight)
popover.behavior = NSPopoverBehavior.Transient
// etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment