Xcode 8 Warning "Instance method nearly matches optional requirement"

macos, swift3, xcode, xcode8

Solution

After hours of searching I found this - Swift 3 ObjC Optional Protocol Method Not Called in Subclass

You can workaround the bug by prefixing the objective-c declaration on the function

@objc(tableViewSettingsDidChange:notification:)
func tableViewSettingsDidChange(_ notification:Notification)

Problem

I converted my (macOS) project to Swift 3 in Xcode 8 and I get the following warnings with several delegate methods I implement in swift classes: ``` Instance method 'someMethod' nearly matches optional requirement of protocol 'protocolName' ``` I get this for several NSApplicationDelegate methods like `applicationDidFinishLaunching` and `applicationDidBecomeActive`: But also for implementations of `tableViewSelectionDidChange`: I used code completion to insert the method signatures and also tried copying them from the SDK-headers to rule out typos. The warnings just don't disappear and the methods are never called. What am I missing here?

Original source

Related problems