8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e128d20 + 2e53062 commit 334ec03Copy full SHA for 334ec03
README.md
@@ -1,4 +1,34 @@
1
-swift-style-guide
2
-=================
+#### Prefer implicit getters on read-only properties and subscripts
3
4
-Style guide & coding conventions for Swift projects
+When possible, omit the `get` keyword on read-only computed properties and
+read-only subscripts.
5
+
6
+So, write these:
7
8
+```swift
9
+var myGreatProperty: Int {
10
+ return 4
11
+}
12
13
+subscript(index: Int) -> T {
14
+ return objects[index]
15
16
+```
17
18
+… not these:
19
20
21
22
+ get {
23
24
+ }
25
26
27
28
29
30
31
32
33
34
+_Rationale:_ The intent and meaning of the first version is clear, and results in less code.
0 commit comments