Objective-C class cannot find definition for Swift protocol

I have a Swift protocol, for example:

@objc protocol Linkable { func presentLink(link: MyLink) } 

I also have an Objective-C class that does not play well with this protocol:

 @protocol Linkable; @interface MyDetailViewController : MyTableViewController <Linkable> etc... 

I logged the protocol correctly, as far as I can tell, the protocol has a @objc note, and I put it in the interface declaration of the Objective-C class, but I still get a warning on the line starting with @interface .

The warning says: "Cannot find protocol definition for" Linkable ".

Oddly enough, it builds and runs, and it works as expected, but why a warning if there really is no problem with Linkable? Is there any other way to declare a protocol or conform to it to clear the warning?

This is just one of the Xcode warnings that is poorly worded, and if so, what really happens?

EDIT

Here is a standalone sample project with the same error: https://github.com/thinkfishhook/Swift-ObjC_Protocol

+5
source share

Source: https://habr.com/ru/post/1264903/


All Articles