[styleguide-attributes] - Adds preference for attributes on the same line as what they attribute to the StyleGuide - MW
MODIFY
.github/STYLEGUIDE.md
.github/STYLEGUIDE.md
@@ -743,6 +743,37 @@ Each guide is broken into a few sections. Sections contain a list of guidelines.
```
</details>
+* **PREFER attributes on the same line as what they are attributing.**
+
+ <details>
+
+ #### Why?
+
+ Because we naturally read lines of code as a consistent line, introducing whitespace makes it that much harder to understand the full context of the line you're trying to understand. This is the same reasoning we put behind preferring a return on the same line as the final parameter in a function declaration.
+
+ NOTE: This does not come at the cost of sanity. If you have an exceptionally large number of attributions then it might indicate that you've gotten overzealous, and it actually obscures your meaning, rather than add to it.
+
+ ```swift
+ // WRONG
+ @objc
+ func thingExposedToObjectiveC() {
+ // ...
+ }
+
+ // WRONG
+ @ViewBuilder @discardableResult @MainActor @inlinable func betYouDoNotEvenKnowWhatThisFunctionDoesAnymore() {
+ // ...
+ }
+
+ // RIGHT
+ @State var stateVar: Bool = true
+ @discardableResult func thing() -> Bool { true }
+ @MainActor class MyClass {
+ // ...
+ }
+ ```
+ </details>
+
### Functions
* **PREFER omitting `Void` return types from function definitions.**

[styleguide-attributes] - Adds preference for attributes on the same line as what they attribute to the StyleGuide - MW