rspec/rules/S4184/swift/rule.adoc

24 lines
633 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.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
@IBOutlet var label: UILabel! // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
@IBOutlet private var label: UILabel!
----
ifdef::env-github,rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]