Improving Controller Design P24 not working


#1

When I add the code on page 26
override var windowNibName: String? {
return “MainWindowController” }

I get the error message Property ‘windowNibName’ with type ‘String?’ cannot override a property with type ‘NSNib.Name?’ Any suggestions for a fix?


#2

The error message is providing a hint as to what the fix should be.

Try this:

override var windowNibName: NSNib.Name? {
   return NSNib.Name (“MainWindowController”)
}

#3

Thank you! Your code snippet worked! I just looked at the error message again and yes you are correct, the error message should have giving me the answer, I am just not used to buying a new book then having code that does not work. :slight_smile: