8000 The One True Way · smashcoding/swift-style-guide@815bcc6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 815bcc6

Browse files
committed
The One True Way
1 parent e0571a5 commit 815bcc6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ internal struct TheFez {
7777

7878
_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.
7979

80+
#### When specifying a type, always associate the colon with the identifier
81+
82+
When specifying the type of an identifier, always put the colon immediately
83+
after the identifier, followed by a space and then the type name.
84+
85+
```swift
86+
class SmallBatchSustainableFairtrade: Coffee { ... }
87+
88+
let timeToCoffee: NSTimeInterval = 2
89+
90+
func makeCoffee(type: CoffeeType) -> Coffee { ... }
91+
```
8092

8193
#### Only explicitly refer to `self` when required
8294

0 commit comments

Comments
 (0)
0