'weak' must not be applied to non-class-bound 'any LBFMListenFooterViewDelegate'; consider adding a protocol conformance that has a class bound
weak不能应用于非类绑定的any LBFMListenFooterViewDelegate;考虑添加一个符合协议的绑定类
protocol LBFMListenFooterViewDelegate: NSObjectProtocol {
func listenFooterAddBtnClick()
}
protocol LBFMListenFooterViewDelegate: class {
func listenFooterAddBtnClick()
}
protocol LBFMListenFooterViewDelegate: AnyObject {
func listenFooterAddBtnClick()
}
protocol LBFMListenFooterViewDelegate {
func listenFooterAddBtnClick()
}
如果你想把一个 swift 的类实现一个 oc 的 protocol ,这个类必须实现 NSObjectProtocol ,跟改名啥的没关系,如果你声明一个 swift 的 protocol 而只有 swift 类实现它,你不需要让这个 protocol 继承自 NSObjectProtocol 。
NSObjectProtocol 实际是 OC 的历史包袱才存在的东西,如果是纯 Swift 的项目(我不是说在 iOS 中),你单独写一个完全与 OC 无关的 swift 项目,你会发现你将永远都不会用到这么个东西。
btw , iOS 项目由于 cocoa 整个都是基于 oc runtime 的,所以你写的所有的 iOS / mac app 都将是与 oc 相关的。