Window will not appear

Hi,

I followed the instructions in chapter 5. Controls twice step by step - using Xcode 8.2.1 supposedly Swift 3.0/3.1

Starting the build without any errors or warnings, being at figure 5.9, the compiled application starts, but no window shows up - even when I switch on in the inspector “Visible at launch”. What might went wrong? What do I need to double-check?

Thanks in advance…!

Michael

If you can build a simple Cocoa application and run it and see the window pop up, then you are probably missing something when following the instructions in chapter 5.

Thanks, I keyed in for a third time from scratch exactly what was to read in the book, of course it is written for Swift 1.2.

Looking closely at the auto-complete suggestions, I discovered in the “func applicationDidFinishLaunching(aNotification: NSNotification)” an underscore “func applicationDidFinishLaunching(_ aNotification: NSNotification)” adding this underscore, leads to a visible window.

So far so good, but Xcode throws a warning, that I need to make this function private. Doing so, silences the warning, but again the window will not appear any longer.

How to get both, the window and no Xcode warning…? :wink:

Swift now has Notification, which bridges to NSNotification. So the following works for me:

func applicationDidFinishLaunching(_ aNotification: Notification)