Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
swift-style-guide
=================
#### Prefer implicit getters on read-only properties and subscripts

Style guide & coding conventions for Swift projects
When possible, omit the `get` keyword on read-only computed properties and
read-only subscripts.

So, write these:

```swift
var myGreatProperty: Int {
return 4
}

subscript(index: Int) -> T {
return objects[index]
}
```

… not these:

```swift
var myGreatProperty: Int {
get {
return 4
}
}

subscript(index: Int) -> T {
get {
return objects[index]
}
}
```

_Rationale:_ The intent and meaning of the first version is clear, and results in less code.