Pattern: Use of class
instead of AnyObject
Issue: -
Prefer using AnyObject
over class
for class-only protocols.
Examples of correct code:
protocol SomeProtocol {}
protocol SomeClassOnlyProtocol: AnyObject {}
protocol SomeClassOnlyProtocol: AnyObject, SomeInheritedProtocol {}
@objc protocol SomeClassOnlyProtocol: AnyObject, SomeInheritedProtocol {}
Examples of incorrect code:
protocol SomeClassOnlyProtocol: ↓class {}
protocol SomeClassOnlyProtocol: ↓class, SomeInheritedProtocol {}
@objc protocol SomeClassOnlyProtocol: ↓class, SomeInheritedProtocol {}