Strong IBOutlet
@IBOutlets shouldn’t be declared as weak
- Identifier:
strong_iboutlet
- Enabled by default: No
- Supports autocorrection: Yes
- Kind: lint
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
class ViewController: UIViewController {
@IBOutlet var label: UILabel?
}
class ViewController: UIViewController {
weak var label: UILabel?
}
Triggering Examples
class ViewController: UIViewController {
@IBOutlet ↓weak var label: UILabel?
}
class ViewController: UIViewController {
@IBOutlet ↓unowned var label: UILabel!
}
class ViewController: UIViewController {
@IBOutlet ↓weak var textField: UITextField?
}