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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -