Weird. Can't prevent speech window from closing

I got to the part where I added the NSWindowDelegate protocol to my MainWindowController class
and added the windowShouldClose function returning !isStarted

But when I run the app and hit the little red dot, the window happily closes regardless of state: speaking or not. (The app is live, but the window closes).

As a test, I changed the function to “return false” just to see if I could prevent the window from closing under any circumstances. Mysteriously, it always closes.

I’ve compared my code with the updated file on github for this exercise and I don’t see anything
wrong. Ideas?

My working theory was that maybe a name or parameter or something had changed. I went back to the NSWindowDelegate documentation and noticed something odd in the signature and then cut out my function and played some games with autocomplete. Boom, something different came up! Here it is:

func windowShouldClose(_ sender: Any) -> Bool {
        return false
    }

The parameters have changed. It works fine now!