In Swift, to check protocol compliance with is or as? downcasting, you must mark the protocol with the @objc attribute. Once you mark a protocol with this attribute, it seems that you cannot have a protocol with enum as a property, because enumerations 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 will receive an error message: error: property cannot be marked @objc because its type cannot be represented in Objective-C
Here is a complete example: http://swiftstub.com/475659213/
In the example, if you change Language to String , then it works fine.
source share