rspec/rules/S4184/swift/rule.adoc

14 lines
473 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Marking a variable with ``++IBOutlet++`` allows it to be connected with a Storyboard component through the Interface Builder. Allowing such a variable to be accessed outside the class, may result in other classes making assignments that override the automatic dependency injection from the Storyboard itself.
== Noncompliant Code Example
----
@IBOutlet var label: UILabel! // Noncompliant
----
== Compliant Solution
----
@IBOutlet private var label: UILabel!
----