I have a Swift protocol, like so:
@objc protocol Linkable {
func presentLink(link: MyLink)
}
I also have an Objective-C class that isn't playing nice with this protocol:
@protocol Linkable;
@interface MyDetailViewController : MyTableViewController <Linkable>
etc...
I have declared the protocol correctly as far as I can tell, the protocol has the @objc
notation, and I'm putting it into the interface declaration of the Objective C class, but I'm still getting a warning at the line that starts @interface
.
The warning says: "Cannot find protocol definition for 'Linkable'."
Oddly, it builds and runs, and it works as expected, but why the warning if there's actually no problem with Linkable? Is there a different way to declare the protocol, or to conform to it that would clear the warning?
Is this just one of Xcode's warnings that is poorly phrased, and if so what's actually going on?
EDIT
Here is a self-contained sample project with the same error: https://github.com/thinkfishhook/Swift-ObjC_Protocol
#import "ViewController.h"
#import "Protocol_WTF-Swift.h"
@interface ViewController () <MyProtocol>
@end
@implementation ViewController
- (void)doTheThings {
// doing the things
}
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With