class_delegate_protocol - ApplebaumIan/BitbucketAPI GitHub Wiki

Class Delegate Protocol

Delegate protocols should be class-only so they can be weakly referenced.

  • Identifier: class_delegate_protocol
  • Enabled by default: Enabled
  • Supports autocorrection: No
  • Kind: lint
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning

Non Triggering Examples

protocol FooDelegate: class {}

protocol FooDelegate: class, BarDelegate {}

protocol Foo {}

class FooDelegate {}

@objc protocol FooDelegate {}

@objc(MyFooDelegate)
 protocol FooDelegate {}

protocol FooDelegate: BarDelegate {}

protocol FooDelegate: AnyObject {}

protocol FooDelegate: NSObjectProtocol {}

Triggering Examples

↓protocol FooDelegate {}

↓protocol FooDelegate: Bar {}