swift - What's the difference between a protocol extended from AnyObject and a class-only protocol? -
both declaration
protocol someprotocol : anyobject { }
and declaration
protocol someprotocol : class { }
seem make classes can conform protocol (i.e. instances of protocol references objects), , have no other effects.
is there difference between them? should 1 preferred on other? if not, why there 2 ways same thing?
i using latest released xcode 6.3.1.
anyobject
protocol classes implicitly conform (source). there no difference: can use either require class constraint.
Comments
Post a Comment