You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+20-21Lines changed: 20 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Our overarching goals are clarity, consistency and brevity, in that order.
11
11
*[Naming](#naming)
12
12
*[Prose](#prose)
13
13
*[Delegates](#delegates)
14
-
*[Use Type Inferred Context](#use-type-inferred-context)
14
+
*[Use Type Inferred Context](#use-type-inferred-context)
15
15
*[Generics](#generics)
16
16
*[Class Prefixes](#class-prefixes)
17
17
*[Language](#language)
@@ -183,7 +183,7 @@ Use extensions to organize your code into logical blocks of functionality. Each
183
183
184
184
### Protocol Conformance
185
185
186
-
In particular, when adding protocol conformance to a model, prefer adding a separate extension for the protocol methods. This keeps the related methods grouped together with the protocol and can simplify instructions to add a protocol to a class with its associated methods.
186
+
In particular, when adding protocol conformance to a model, prefer adding a separate extension for the protocol methods. This keeps the related methods grouped together with the protocol and can simplify instructions to add a protocol to a class with its associated methods.
187
187
188
188
**Preferred:**
189
189
```swift
@@ -252,8 +252,8 @@ Keep imports minimal. For example, don't import `UIKit` when importing `Foundati
252
252
253
253
* Indent using 2 spaces rather than tabs to conserve space and help prevent line wrapping. Be sure to set this preference in Xcode and in the Project settings as shown below:
254
254
255
-

256
-
255
+

256
+
257
257
* Method braces and other braces (`if`/`else`/`switch`/`while` etc.) always open on the same line as the statement but close on a new line.
258
258
* Tip: You can re-indent by selecting some code (or ⌘A to select all) and then Control-I (or Editor\Structure\Re-Indent in the menu). Some of the Xcode template code will have 4-space tabs hard coded, so this is a good way to fix that.
259
259
@@ -279,7 +279,7 @@ else {
279
279
280
280
* There should be exactly one blank line between methods to aid in visual clarity and organization. Whitespace within methods should separate functionality, but having too many sections in a method often means you should refactor into several methods.
281
281
282
-
* Colons always have no space on the left and one space on the right. Exceptions are the ternary operator `? :`, empty dictionary `[:]` and `#selector` syntax for unnamed parameters `(_:)`.
282
+
* Colons always have no space on the left and one space on the right. Exceptions are the ternary operator `? :`, empty dictionary `[:]` and `#selector` syntax for unnamed parameters `(_:)`.
283
283
284
284
**Preferred:**
285
285
```swift
@@ -403,7 +403,7 @@ Marking classes or members as `final` in tutorials can distract from the main to
403
403
```swift
404
404
// Turn any generic type into a reference type using this Box class.
405
405
finalclassBox<T> {
406
-
let value: T
406
+
let value: T
407
407
init(_value: T) {
408
408
self.value= value
409
409
}
@@ -687,8 +687,8 @@ Extend object lifetime using the `[weak self]` and `guard let strongSelf = self
687
687
**Preferred**
688
688
```swift
689
689
resource.request().onComplete { [weakself] response in
690
-
guardlet strongSelf =selfelse {
691
-
return
690
+
guardlet strongSelf =selfelse {
691
+
return
692
692
}
693
693
let model = strongSelf.updateModel(response)
694
694
strongSelf.updateUI(model)
@@ -787,15 +787,14 @@ When coding with conditionals, the left-hand margin of the code should be the "g
// use context and input to compute the frequencies
798
-
799
798
return frequencies
800
799
}
801
800
```
@@ -822,10 +821,10 @@ When multiple optionals are unwrapped either with `guard` or `if let`, minimize
822
821
823
822
**Preferred:**
824
823
```swift
825
-
guardlet number1 = number1,
826
-
let number2 = number2,
827
-
let number3 = number3 else {
828
-
fatalError("impossible")
824
+
guardlet number1 = number1,
825
+
let number2 = number2,
826
+
let number3 = number3 else {
827
+
fatalError("impossible")
829
828
}
830
829
// do something with numbers
831
830
```
@@ -898,14 +897,14 @@ let playerMark = (player == current ? "X" : "O")
898
897
899
898
Where an Xcode project is involved, the organization should be set to `Ray Wenderlich` and the Bundle Identifier set to `com.razeware.TutorialName` where `TutorialName` is the name of the tutorial project.
0 commit comments