I have been following this tutorial to learn swift & iOS app development. In the Protocol section, the tutorial defined the following protocol:
@objc protoco
In order for a type to conform to a protocol marked @objc
, that type must also marked with @objc
or the methods being used to satisfy the protocol must be.
Using @objc
on a declaration tells the compiler to expose it to the Objective-C runtime. In order for that to be possible, the type that was declared @objc
must be able to be represented in Objective-C.
For classes this means they must inherit from NSObject. For methods, this means they become backed by dynamic Objective-C message passing.