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
throwError(message: "The given number was not a digit.")
576
+
}
575
577
}
576
578
```
577
579
@@ -608,7 +610,7 @@ unowned var parentViewController: UIViewController
608
610
609
611
***3.5.5** When unwrapping optionals, use the same name for the unwrapped constant or variable where appropriate.
610
612
611
-
```
613
+
```swift
612
614
guardlet myValue = myValue else {
613
615
return
614
616
}
@@ -727,9 +729,9 @@ doSomething(1.0, success: { (parameter1) in
727
729
728
730
### 3.9 Arrays
729
731
730
-
***3.9.1** In general, avoid accessing an array directly with subscripts. When possible, use accessors such as `.first` or `.last`, which are optional and won’t crash. Prefer using a `for item in items` syntax when possible as opposed to something like `for i in 0..<items.count`. If you need to access an array subscript directly, make sure to do proper bounds checking. You can use `for (index, value) in items.enumerate()` to get both the index and the value.
732
+
***3.9.1** In general, avoid accessing an array directly with subscripts. When possible, use accessors such as `.first` or `.last`, which are optional and won’t crash. Prefer using a `for item in items` syntax when possible as opposed to something like `for i in 0..<items.count`. If you need to access an array subscript directly, make sure to do proper bounds checking. You can use `for (index, value) in items.enumerated()` to get both the index and the value.
731
733
732
-
***3.9.2** Never use the `+=` or `+` operator to append/concatenate to arrays. Instead, use `.append()` or `.appendContentsOf()` as these are far more performant (at least with respect to compilation) in Swift's current state. If you are declaring an array that is based on other arrays and want to keep it immutable, instead of `let myNewArray = arr1 + arr2`, use `let myNewArray = [arr1, arr2].flatten()`.
734
+
***3.9.2** Never use the `+=` or `+` operator to append/concatenate to arrays. Instead, use `.append()` or `.append(contentsOf:)` as these are far more performant (at least with respect to compilation) in Swift's current state. If you are declaring an array that is based on other arrays and want to keep it immutable, instead of `let myNewArray = arr1 + arr2`, use `let myNewArray = [arr1, arr2].flatten()`.
733
735
734
736
### 3.10 Error Handling
735
737
@@ -899,7 +901,7 @@ if let monkeyIsland = monkeyIsland {
0 commit comments