我有点困惑.protocol A : class { ... }和之间的区别是什么protocol A{ ... },我们应该在swift中使用哪一个?
PS:我们写这样的时候出错了
protocol A{ ... }
weak var delegate: A
Run Code Online (Sandbox Code Playgroud)
错误:'weak'不能应用于非类类型
我们刚刚在iPhone设备iOS 11上得到了一些奇怪的崩溃反馈.这是一个信息:
UIKit: -[_UIKeyBoardBasedNonEditableTextSelectionGestureCluster oneFingerForcePress:]
我只是想不出来是什么UIKeyBoardBasedNonEditableTextSelectionGestureCluster.有什么想法吗?
看起来协议中不允许使用弱引用.那么,如果我想添加一个弱引用,我该怎么办呢?有什么好主意吗?
protocol PipelineElementDelegate: class {
func someFunc()
}
protocol PipelineElement {
weak var delegate: PipelineElementDelegate? { get set}
}
Run Code Online (Sandbox Code Playgroud)