Reputation: 535
How can I convert NSApplicationPresentationOptions
to AnyObject?
? The as
doesn't work here.
I want to call:
func enterFullScreenMode(_ screen: NSScreen, withOptions options: [NSObject: AnyObject]?) -> Bool
I have:
let presOptions: NSApplicationPresentationOptions =
.HideDock | // Dock is entirely unavailable. Spotlight menu is disabled.
.AutoHideMenuBar | // Menu Bar appears when moused to.
.DisableAppleMenu | // All Apple menu items are disabled.
.DisableProcessSwitching | // Cmd+Tab UI is disabled. All Exposé functionality is also disabled.
.DisableForceQuit | // Cmd+Opt+Esc panel is disabled.
.DisableSessionTermination | // PowerKey panel and Restart/Shut Down/Log Out are disabled.
.DisableHideApplication | // Application "Hide" menu item is disabled.
.AutoHideToolbar |
.FullScreen
let optionsDictionary = [NSFullScreenModeApplicationPresentationOptions: presOptions]
browserWindowController.containerView.enterFullScreenMode(NSScreen.mainScreen()!, withOptions: optionsDictionary)
This gives me an error on the last line of:
Cannot invoke 'enterFullScreenMode' with an argument list of type '(NSScreen, with Options: [String : NSApplicationPresentationOptions])'
Upvotes: 0
Views: 378
Reputation: 539685
According to the documentation, the corresponding value for the
key
NSFullScreenModeApplicationPresentationOptions
is an instance of NSNumber
containing an unsigned integer value of NSApplicationPresentationOptions
, so this should work:
let optionsDictionary = [NSFullScreenModeApplicationPresentationOptions :
NSNumber(unsignedLong: presOptions.rawValue)]
Upvotes: 1