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
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1056,6 +1056,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1056
1056
]
1057
1057
```
1058
1058
1059
+
</details>
1060
+
1059
1061
* <a id='long-typealias'></a>(<a href='#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 `&`. [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#wrapArguments)
1060
1062
1061
1063
<details>
@@ -1084,6 +1086,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
@@ -1110,6 +1114,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1110
1114
& UniverseSimulatorServiceProviding
1111
1115
```
1112
1116
1117
+
</details>
1118
+
1113
1119
* <a id='prefer-if-let-shorthand'></a>(<a href='#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. [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#redundantOptionalBinding)
1114
1120
1115
1121
<details>
@@ -1142,6 +1148,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1142
1148
else { … }
1143
1149
```
1144
1150
1151
+
</details>
1152
+
1145
1153
* <a id='else-on-same-line'></a>(<a href='#else-on-same-line'>link</a>) **Else statements should start on the same line as the previous condition's closing brace, unless the conditions are separated by a blank line or comments.** [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#elseOnSameLine)
1146
1154
1147
1155
<details>
@@ -1196,6 +1204,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1196
1204
}
1197
1205
```
1198
1206
1207
+
</details>
1208
+
1199
1209
* <a id='multi-line-conditions'></a>(<a href='#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). [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#wrapArguments)
1200
1210
1201
1211
<details>
@@ -1609,6 +1619,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1609
1619
}
1610
1620
```
1611
1621
1622
+
</details>
1623
+
1612
1624
* <a id='indent-multiline-string-literals'></a>(<a href='#indent-multiline-string-literals'>link</a>) **Indent the body and closing triple-quote of multiline string literals**, unless the string literal begins on its own line in which case the string literal contents and closing triple-quote should have the same indentation as the opening triple-quote. [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#indent)
1613
1625
1614
1626
<details>
@@ -1779,6 +1791,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
1779
1791
}
1780
1792
```
1781
1793
1794
+
</details>
1795
+
1782
1796
* <a id='no-spaces-around-function-parens'></a>(<a href='#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. [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#spaceInsideParens) [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#spaceAroundParens)
1783
1797
1784
1798
<details>
@@ -3010,6 +3024,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
3010
3024
}
3011
3025
```
3012
3026
3027
+
</details>
3028
+
3013
3029
* <a id='avoid-global-functions'></a>(<a href='#avoid-global-functions'>link</a>) **Avoid global functions whenever possible.** Prefer methods within type definitions.
3014
3030
3015
3031
<details>
@@ -4694,6 +4710,8 @@ _You can enable the following settings in Xcode by running [this script](resourc
4694
4710
}
4695
4711
```
4696
4712
4713
+
</details>
4714
+
4697
4715
* <a id='prefer-throwing-tests'></a>(<a href='#prefer-throwing-tests'>link</a>) **Prefer throwing tests to `try!`**. `try!` will crash your test suite like a force-unwrapped optional. XCTest and Swift Testing support throwing test methods, so use that instead. [](https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#noForceTryInTests)
0 commit comments