35 lines
520 B
Plaintext
35 lines
520 B
Plaintext
== Why is this an issue?
|
|
|
|
In the interests of clean code, getters should be implicit, rather than explicit for properties that have only getters.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,swift]
|
|
----
|
|
var luckyNumber: Int {
|
|
get { // Noncompliant
|
|
return 7
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
var luckyNumber: Int {
|
|
return 7
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|