Skip to content

Instantly share code, notes, and snippets.

@andreyrd
Created February 23, 2018 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreyrd/a79cd3207931911e834179a94204ace5 to your computer and use it in GitHub Desktop.
Save andreyrd/a79cd3207931911e834179a94204ace5 to your computer and use it in GitHub Desktop.
Doesn't work with Swift4
var topLevelObjects = NSArray()
Bundle.main.loadNibNamed(NSNib.Name("MyCustomView"), owner: self, topLevelObjects: &topLevelObjects)
let views = (topLevelObjects as Array).filter { $0 is NSView }
let content = views[0] as! NSView
content.frame = bounds
addSubview(content)
@andreyrd
Copy link
Author

andreyrd commented Feb 23, 2018

Errors out with: Cannot pass immutable value as inout argument: implicit conversion from 'NSArray' to 'NSArray?' requires a temporary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment