private_outlet - ApplebaumIan/BitbucketAPI GitHub Wiki

Private Outlets

IBOutlets should be private to avoid leaking UIKit to higher layers.

  • Identifier: private_outlet
  • Enabled by default: Disabled
  • Supports autocorrection: No
  • Kind: lint
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning, allow_private_set: false

Non Triggering Examples

class Foo {
  @IBOutlet private var label: UILabel?
}

class Foo {
  @IBOutlet private var label: UILabel!
}

class Foo {
  var notAnOutlet: UILabel
}

class Foo {
  @IBOutlet weak private var label: UILabel?
}

class Foo {
  @IBOutlet private weak var label: UILabel?
}

Triggering Examples

class Foo {
  @IBOutlet ↓var label: UILabel?
}

class Foo {
  @IBOutlet ↓var label: UILabel!
}