
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
49 lines
1.0 KiB
Plaintext
49 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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
|
|
|
|
[source,swift]
|
|
----
|
|
@IBOutlet var label: UILabel! // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
@IBOutlet private var label: UILabel!
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Make this "IBOutlet" variable private.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
variable declaration
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 5 Sep 2017, 18:56:31 Ann Campbell wrote:
|
|
I've made some small edits [~carlo.bottiglieri], but not substantially changed your meaning, I think.
|
|
|
|
=== on 6 Sep 2017, 10:17:52 Carlo Bottiglieri wrote:
|
|
Thanks a lot [~ann.campbell.2]
|
|
|
|
endif::env-github,rspecator-view[]
|