I need to define a protocol which can be called in a class that use some Objective-c type
But doing that doesn't work:
enum NewsCellActionType: Int {
case Vote = 0
case Comments
case Time
}
@objc protocol NewsCellDelegate {
func newsCellDidSelectButton(cell: NewsCell, actionType: NewsCellActionType)
}
You get he error
Swift enums cannot be represented in Objective-C
If I don't put the @objc tag on my protocol it'll crash the app as soon as it's called in a class which adopt the protocol AND inherit from an Objective-C type class (like a UIViewController).
So my question is, how should I declare and pass my enum with the @objc tag?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…