Group Group Group Group Group Group Group Group Group

ScaryBugs error

I am a newbie working through the first ScaryBugsMac example (Getting Started with OSX and Swift Tutorial Part 1)

At the point where I am instantiating the masterView Controller and adding a subview, I am getting an error that I cannot resolve. Some insight would be helpful.

masterViewController = MasterViewController(nibName: “MasterViewController”, bundle: nil)

window.contentView.addSubview(masterViewController.view)
masterViewController.view.frame = (window.contentView as! NSView).bounds

Produces the following error messages:

line 2: value of optional type ‘NSView?’ not unwrapped; did you mean to use ! or ‘?’?
line 3: Downcast from ‘NSView?’ to 'NSView only unwraps optionals; did you mean to use ‘!’?

Content from the tutorial is:

masterViewController = MasterViewController(nibName: “MasterViewController”, bundle: nil)

window.contentView.addSubview(masterViewController.view)
masterViewController.view.frame = (window.contentView as! NSView).bounds

OSX 10.11.4 / Xcode 7.3

Thanks in advance.

hi @jarea,
I hope this is resolved. This sounds more like a swift transition from version to version issue.

cheers,