iOS開發筆記-67:swift4-代理-protocol-optional-Method cannot be marked @objc because the type of the parameter 1 cannot be represented in Objective-C

錯誤:Method cannot be marked @objc because the type of the parameter 1 cannot be represented in Objective-C

@objc protocol JJViewDelegate: class {
    @objc optional func JJClicked(model: JJModel, isSelected: Bool)
}
swift4中代理方法可選需要在前面加@objc
然后在加玩@objc后還是有上面的報錯,
這是因為JJModel沒有加@objc
所以需要
@objc class JJModel: NSObject {
  }
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容