- 方法一:声明 protocol 只能被 class 遵守
protocol MyDelegate: class {
}
- 方法二:继承 NSObjectProtocol
protocol MyDelegate: NSObjectProtocol {
}
- 方法三:标记为 @objc
@objc protocol MyDelegate {
}
protocol MyDelegate: class {
}
protocol MyDelegate: NSObjectProtocol {
}
@objc protocol MyDelegate {
}