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.md
+21-29Lines changed: 21 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,12 +156,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
156
156
let myFleet =SpaceFleet()
157
157
```
158
158
159
-
</details>
160
-
161
159
_Exception: You may prefix a private property with an underscore if it is backing an identically-named property or method with a higher access level._
162
160
163
-
<details>
164
-
165
161
#### Why?
166
162
167
163
There are specific scenarios where a backing property or method that is prefixed with an underscore could be easier to read than using a more descriptive name.
@@ -552,7 +548,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
552
548
553
549
</details>
554
550
555
-
- <aid='trailing-commas'></a>(<ahref='#trailing-commas'>link</a>) \*_Add a trailing comma after the last element of multi-line, multi-element comma-separated lists._ This includes arrays, dictionaries, function declarations, function calls, etc. Don't include a trailing comma if the list spans only a single line, or contains only a single element.
551
+
- <aid='trailing-commas'></a>(<ahref='#trailing-commas'>link</a>) **Add a trailing comma after the last element of multi-line, multi-element comma-separated lists.** This includes arrays, dictionaries, function declarations, function calls, etc. Don't include a trailing comma if the list spans only a single line, or contains only a single element.
556
552
557
553
<details>
558
554
@@ -1105,7 +1101,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
1105
1101
1106
1102
</details>
1107
1103
1108
-
- <aid='long-typealias'></a>(<ahref='#long-typealias'>link</a>) [Long](https://github.com/airbnb/swift#column-width) type aliases of protocol compositions should wrap before the `=` and before each individual `&`.
1104
+
- <aid='long-typealias'></a>(<ahref='#long-typealias'>link</a>) **[Long](#column-width) type aliases of protocol compositions should wrap before the `=` and before each individual `&`.**
1109
1105
1110
1106
<details>
1111
1107
@@ -1167,7 +1163,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
1167
1163
1168
1164
</details>
1169
1165
1170
-
- <aid='prefer-if-let-shorthand'></a>(<ahref='#prefer-if-let-shorthand'>link</a>) Omit the right-hand side of the expression when unwrapping an optional property to a non-optional property with the same name.
1166
+
- <aid='prefer-if-let-shorthand'></a>(<ahref='#prefer-if-let-shorthand'>link</a>) **Omit the right-hand side of the expression when unwrapping an optional property to a non-optional property with the same name.**
1171
1167
1172
1168
<details>
1173
1169
@@ -1261,15 +1257,15 @@ _You can enable the following settings in Xcode by running [this script](resourc
1261
1257
1262
1258
</details>
1263
1259
1264
-
- <aid='multi-line-conditions'></a>(<ahref='#multi-line-conditions'>link</a>) **Multi-line conditional statements should break after the leading keyword.** Indent each individual statement by [2 spaces](https://github.com/airbnb/swift#spaces-over-tabs).
1260
+
- <aid='multi-line-conditions'></a>(<ahref='#multi-line-conditions'>link</a>) **Multi-line conditional statements should break after the leading keyword.** Indent each individual statement by [2 spaces](#spaces-over-tabs).
Breaking after the leading keyword resets indentation to the standard [2-space grid](https://github.com/airbnb/swift#spaces-over-tabs),
1268
+
Breaking after the leading keyword resets indentation to the standard [2-space grid](#spaces-over-tabs),
1273
1269
which helps avoid fighting Xcode's <kbd>^</kbd> + <kbd>I</kbd> indentation behavior.
1274
1270
1275
1271
```swift
@@ -1780,7 +1776,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
1780
1776
1781
1777
</details>
1782
1778
1783
-
- <aid='single-line-expression-braces'></a>(<ahref='#single-line-expression-braces'>link</a>) The opening brace following a single-line expression should be on the same line as the rest of the statement.
1779
+
- <aid='single-line-expression-braces'></a>(<ahref='#single-line-expression-braces'>link</a>) **The opening brace following a single-line expression should be on the same line as the rest of the statement.**
1784
1780
1785
1781
<details>
1786
1782
@@ -1817,7 +1813,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
1817
1813
1818
1814
</details>
1819
1815
1820
-
- <aid='multi-line-expression-braces'></a>(<ahref='#multi-line-expression-braces'>link</a>) The opening brace following a multi-line expression should wrap to a new line.
1816
+
- <aid='multi-line-expression-braces'></a>(<ahref='#multi-line-expression-braces'>link</a>) **The opening brace following a multi-line expression should wrap to a new line.**
1821
1817
1822
1818
<details>
1823
1819
@@ -1876,7 +1872,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
1876
1872
1877
1873
</details>
1878
1874
1879
-
- <aid='no-spaces-around-function-parens'></a>(<ahref='#no-spaces-around-parens'>link</a>) For function calls and declarations, there should be no spaces before or inside the parentheses of the argument list.
1875
+
- <aid='no-spaces-around-function-parens'></a>(<ahref='#no-spaces-around-parens'>link</a>) **For function calls and declarations, there should be no spaces before or inside the parentheses of the argument list.**
1880
1876
1881
1877
<details>
1882
1878
@@ -2100,7 +2096,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2100
2096
2101
2097
</details>
2102
2098
2103
-
- <aid='whitespace-around-comment-delimiters'></a>(<ahref='#whitespace-around-comment-delimiters'>link</a>) Include spaces or newlines before and after comment delimiters (`//`, `///`, `/*`, and `*/`)
2099
+
- <aid='whitespace-around-comment-delimiters'></a>(<ahref='#whitespace-around-comment-delimiters'>link</a>) **Include spaces or newlines before and after comment delimiters** (`//`, `///`, `/*`, and `*/`)
2104
2100
2105
2101
<details>
2106
2102
@@ -2132,7 +2128,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2132
2128
2133
2129
</details>
2134
2130
2135
-
- <aid='space-in-empty-braces'></a>(<ahref='#space-in-empty-braces'>link</a>) Include a single space in an empty set of braces (`{ }`).
2131
+
- <aid='space-in-empty-braces'></a>(<ahref='#space-in-empty-braces'>link</a>) **Include a single space in an empty set of braces** (`{ }`).
2136
2132
2137
2133
<details>
2138
2134
@@ -2265,7 +2261,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2265
2261
2266
2262
</details>
2267
2263
2268
-
- <aid='long-function-declaration'></a>(<ahref='#long-function-declaration'>link</a>) **Separate [long](https://github.com/airbnb/swift#column-width) function declarations with line breaks before each argument label, and before the closing parenthesis (`)`).**
2264
+
- <aid='long-function-declaration'></a>(<ahref='#long-function-declaration'>link</a>) **Separate [long](#column-width) function declarations with line breaks before each argument label, and before the closing parenthesis (`)`).**
2269
2265
2270
2266
<details>
2271
2267
@@ -2342,7 +2338,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2342
2338
2343
2339
</details>
2344
2340
2345
-
- <aid='long-function-invocation'></a>(<ahref='#long-function-invocation'>link</a>) **[Long](https://github.com/airbnb/swift#column-width) function calls should also break on each argument.** Put the closing parenthesis on its own line.
2341
+
- <aid='long-function-invocation'></a>(<ahref='#long-function-invocation'>link</a>) **[Long](#column-width) function calls should also break on each argument.** Put the closing parenthesis on its own line.
2346
2342
2347
2343
<details>
2348
2344
@@ -2785,7 +2781,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2785
2781
2786
2782
</details>
2787
2783
2788
-
- <aid='long-ternary-operator-expressions'></a>(<ahref='#long-ternary-operator-expressions'>link</a>) **[Long](https://github.com/airbnb/swift#column-width) ternary operator expressions should wrap before the `?` and before the `:`**, putting each conditional branch on a separate line.
2784
+
- <aid='long-ternary-operator-expressions'></a>(<ahref='#long-ternary-operator-expressions'>link</a>) **[Long](#column-width) ternary operator expressions should wrap before the `?` and before the `:`**, putting each conditional branch on a separate line.
2789
2785
2790
2786
<details>
2791
2787
@@ -2812,7 +2808,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2812
2808
2813
2809
</details>
2814
2810
2815
-
- <aid='use-commas-in-and-conditions'></a>(<ahref='#use-commas-in-and-conditions'>link</a>) In conditional statements (`if`, `guard`, `while`), separate boolean conditions using commas (`,`) instead of `&&` operators.
2811
+
- <aid='use-commas-in-and-conditions'></a>(<ahref='#use-commas-in-and-conditions'>link</a>) **In conditional statements (`if`, `guard`, `while`), separate boolean conditions using commas (`,`) instead of `&&` operators.**
2816
2812
2817
2813
<details>
2818
2814
@@ -2848,7 +2844,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
2848
2844
2849
2845
</details>
2850
2846
2851
-
- <aid='prefer-bound-generic-extension-shorthand'></a>(<ahref='#prefer-bound-generic-extension-shorthand'>link</a>) When extending bound generic types, prefer using generic bracket syntax (`extension Collection<Planet>`), or sugared syntax for applicable standard library types (`extension [Planet]`) instead of generic type constraints.
2847
+
- <aid='prefer-bound-generic-extension-shorthand'></a>(<ahref='#prefer-bound-generic-extension-shorthand'>link</a>) **When extending bound generic types, prefer using generic bracket syntax (`extension Collection<Planet>`), or sugared syntax for applicable standard library types (`extension [Planet]`) instead of generic type constraints.**
2852
2848
2853
2849
<details>
2854
2850
@@ -3207,13 +3203,13 @@ _You can enable the following settings in Xcode by running [this script](resourc
3207
3203
</details>
3208
3204
3209
3205
- <aid='namespace-using-enums'></a>(<ahref='#namespace-using-enums'>link</a>) **Use caseless `enum`s for organizing `public` or `internal` constants and functions into namespaces.**
3210
-
- Avoid creating non-namespaced global constants and functions.
3211
-
- Feel free to nest namespaces where it adds clarity.
3212
-
-`private` globals are permitted, since they are scoped to a single file and do not pollute the global namespace. Consider placing private globals in an `enum` namespace to match the guidelines for other declaration types.
- Avoid creating non-namespaced global constants and functions.
3211
+
- Feel free to nest namespaces where it adds clarity.
3212
+
-`private` globals are permitted, since they are scoped to a single file and do not pollute the global namespace. Consider placing private globals in an `enum` namespace to match the guidelines for other declaration types.
3217
3213
3218
3214
#### Why?
3219
3215
@@ -3587,7 +3583,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
3587
3583
3588
3584
</details>
3589
3585
3590
-
- <aid='switch-avoid-default'></a>(<ahref='#switch-avoid-default'>link</a>) When switching over an enum, generally prefer enumerating all cases rather than using the `default` case.
3586
+
- <aid='switch-avoid-default'></a>(<ahref='#switch-avoid-default'>link</a>) **When switching over an enum, generally prefer enumerating all cases rather than using the `default` case.**
3591
3587
3592
3588
<details>
3593
3589
@@ -4350,7 +4346,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
4350
4346
4351
4347
</details>
4352
4348
4353
-
- <aid='url-macro'></a>(<ahref='#url-macro'>link</a>) **If available in your project, prefer using a `#URL(_:)` macro instead of force-unwrapping `URL(string:)!` initializer`**.
4349
+
- <aid='url-macro'></a>(<ahref='#url-macro'>link</a>) **If available in your project, prefer using a `#URL(_:)` macro instead of force-unwrapping `URL(string:)!` initializer**.
4354
4350
4355
4351
<details>
4356
4352
@@ -4374,7 +4370,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
4374
4370
4375
4371
## File Organization
4376
4372
4377
-
- <aid='alphabetize-and-deduplicate-imports'></a>(<ahref='#alphabetize-and-deduplicate-imports'>link</a>) **Alphabetize and deduplicate module imports within a file. Place all imports at the top of the file below the header comments. Do not add additional line breaks between import statements. Add a single empty line before the first import and after the last import.**
4373
+
- <aid='alphabetize-and-deduplicate-imports'></a>(<ahref='#alphabetize-and-deduplicate-imports'>link</a>) **Alphabetize and deduplicate module imports within a file.** Place all imports at the top of the file below the header comments. Do not add additional line breaks between import statements. Add a single empty line before the first import and after the last import.
4378
4374
4379
4375
<details>
4380
4376
@@ -4407,12 +4403,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
4407
4403
importFoundation
4408
4404
```
4409
4405
4410
-
</details>
4411
-
4412
4406
_Exception: `@testable import` should be grouped after the regular import and separated by an empty line._
0 commit comments