How to use Enums as parameters in Swift Protocols optional functions
enums, ios, protocols, swift
Solution
The @objc attribute makes the protocol compatible (i.e. usable) with Objective C. But swift enums (prior to 1.2 beta) are not available in Objective C. So you cannot use a swift enum in that protocol.
I think that the best solution is to use swift 1.2 - it's still in beta (as of today), but it's possible to apply the `@objc` attribute to swift enums.
Problem
I have this enum in Swift ``` enum Direction: Int{ case Left2Right = 0, Right2Left } ``` And this protocol ``` @objc protocol CellDelegate : NSObjectProtocol{ optional func has(direction:SwipeDirection) -> Bool } ``` I am getting this error `Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C` Can anybody tell me why do i get this error and how to fix it please? Thanks!