rspec/rules/S2962/swift/rule.adoc
2022-02-04 16:28:24 +00:00

45 lines
666 B
Plaintext

For read-only computed properties and subscript declarations, the ``++get++`` keyword and its braces are optional, and should be omitted for the sake of brevity.
== Noncompliant Code Example
[source,swift]
----
struct Magic {
var number:Int {
get { // Noncompliant
return 42
}
}
}
----
== Compliant Solution
[source,swift]
----
struct Magic {
var number:Int {
return 42
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]