Before all, I have to admint that all the following is my fault, I should be more careful… etc, etc, …
But let me explain.
In an OSX App, I have implemented windowWillClose().
Unfortuately, I forgot (stupid me) to declare thet tha controller conforms to NSWindowDelegate.
Of course, windowWillClose was never called ! But the error remained unoticezd for quite a time (actions in windowWillClose were not critical, more user comfort).
In some cases, compiler is able to detect very complex error patterns. But not this.
Except by using code coverage (or being more attentive when looking at code), is there a way to detect such an error ?
Similar case ; the signature of windowWillClose changed between Swift 2 and 3.
For some reason, I had some calls unchanged in the conversion (unless I mistakenly typed that way in Swift 3)
func windowWillClose(notification: NSNotification) instead of func windowWillClose(_ notification: Notification)
Once again, except by using code coverage, is there a way to detect such an error ?