Merge branch 'master' into jspahrsummers-patch-1

This commit is contained in:
Justin Spahr-Summers 2014-08-26 12:46:01 -07:00
Родитель 94737f7711 4568978d0a
Коммит fc6b1eb5ed
1 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,9 @@ then open a pull request. :zap:
* Tabs, not spaces.
* End files with a newline.
* Make liberal use of vertical whitespace to divide code into logical chunks.
* Dont leave trailing whitespace.
* Not even leading indentation on blank lines.
#### Prefer implicit getters on read-only properties and subscripts
@ -74,6 +77,22 @@ internal struct TheFez {
_Rationale:_ It's rarely appropriate for top-level definitions to be specifically `internal`, and being explicit ensures that careful thought goes into that decision. Within a definition, reusing the same access control specifier is just duplicative, and the default is usually reasonable.
#### When specifying a type, always associate the colon with the identifier
When specifying the type of an identifier, always put the colon immediately
after the identifier, followed by a space and then the type name.
```swift
class SmallBatchSustainableFairtrade: Coffee { ... }
let timeToCoffee: NSTimeInterval = 2
func makeCoffee(type: CoffeeType) -> Coffee { ... }
```
_Rationale:_ The type specifier is saying something about the _identifier_ so
it should be positioned with it.
#### Only explicitly refer to `self` when required
When accessing properties or methods on `self`, leave the reference to `self` implicit by default: