What's the difference between a protocol extended from AnyObject and a class-only protocol?

前端 未结 6 1918
一整个雨季
一整个雨季 2020-12-02 14:30

Both this declaration

protocol SomeProtocol : AnyObject {
}

and this declaration

protocol SomeProtocol : class {
}
<         


        
6条回答
  •  一生所求
    2020-12-02 14:57

    AnyObject is a protocol to which all classes implicitly conform (source). So I would say there is no difference: you can use either to require class constraint.

提交回复
热议问题