- 方法一:声明 protocol 只能被 class 遵守
protocol MyDelegate: class {
}
- 方法二:继承 NSObjectProtocol
protocol MyDelegate: NSObjectProtocol {
}
- 方法三:标记为 @objc
@objc protocol MyDelegate {
}
protocol MyDelegate: class {
}
protocol MyDelegate: NSObjectProtocol {
}
@objc protocol MyDelegate {
}
本文标题:Swift中弱引用Protocol
本文链接:https://www.haomeiwen.com/subject/fyxcottx.html
网友评论