Skip to content

Files

Latest commit

 

History

History
48 lines (31 loc) · 600 Bytes

private_outlet.md

File metadata and controls

48 lines (31 loc) · 600 Bytes

Pattern: Non-private @IBOutlet

Issue: -

Description

@IBOutlet should be private to avoid leaking UIKit to higher layers.

Examples of correct code:

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?
}

Examples of incorrect code:

class Foo {
  @IBOutlet var label: UILabel?
}


class Foo {
  @IBOutletvar label: UILabel!
}