I am new to iOS development. I created a swift class as follows:
import WatchConnectivity;
import HealthKit;
@objc class Blah : NSObject, WCSessionDelegate {
...
}
I need @objc so that I could use this class from objective-C (that already exists). The problem is that when the compiler creates bridge [productName]-Swift.h, it complains that it cannot find WCSessionDelegate. Exact error:
Cannot find protocol declaration for 'WCSessionDelegate'; did you mean 'NSURLSessionDelegate'?
SWIFT_CLASS("_TtC8test8Blah")
@interface Blah: NSObject <WCSessionDelegate>
Instead of implementing that delegate, if I change it to the following, it works.
@objc class Blah : NSObject {
...
func setSessionDelegate(delegate:WCSessionDelegate) -> Blah {
self.mDelegate = delegate;
return(self)
}
}
I prefer the former way. How do I resolve this compilation error? Thanks