In Swift, in order to check protocol conformance with is
or as?
downcasting you must mark the protocol with the @objc
attribute. Once you mark a protocol with that attribute it seems you can not have a protocol with an enum as a property because enums cannot be represented in Objective-C.
enum Language:String {
case English = "English"
case Spanish = "Spanish"
case German = "German"
}
@objc protocol Humanizable {
var language:Language { get set }
}
You'll get an error: error: property cannot be marked @objc because its type cannot be represented in Objective-C
Here is full example: http://swiftstub.com/475659213/
In the example if you change the Language
to String
then it works fine.