# ScaryBugs error

**URL:** <https://forums.kodeco.com/t/scarybugs-error/14047>\
**Category:** Swift\
**Created:** [April 26, 2016, 3:54pm UTC](https://forums.kodeco.com/t/scarybugs-error/14047 "2016-04-26T15:54:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarea](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jarea/32/31205_2.png) [@jarea](https://forums.kodeco.com/u/jarea)\
**Post date:** [April 26, 2016, 3:54pm UTC](https://forums.kodeco.com/t/scarybugs-error/14047/1 "2016-04-26T15:54:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jayantvarma](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jayantvarma/32/111768_2.png) [@jayantvarma](https://forums.kodeco.com/u/jayantvarma)\
**Post date:** [March 16, 2019, 11:03pm UTC](https://forums.kodeco.com/t/scarybugs-error/14047/2 "2019-03-16T23:03:29Z")

</div>

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

cheers,
