- 方法一:聲明 protocol 只能被 class 遵守
protocol MyDelegate: class {
}
- 方法二:繼承 NSObjectProtocol
protocol MyDelegate: NSObjectProtocol {
}
- 方法三:標(biāo)記為 @objc
@objc protocol MyDelegate {
}
protocol MyDelegate: class {
}
protocol MyDelegate: NSObjectProtocol {
}
@objc protocol MyDelegate {
}