Skip to content

Commit dbe5737

Browse files
committed
Add example of a macro
1 parent 65679af commit dbe5737

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
697697
<details>
698698

699699
```swift
700-
// WRONG
700+
// WRONG. These simple property wrappers should be written on the same line as the declaration.
701701
struct SpaceshipDashboardView {
702702

703703
@State
@@ -724,7 +724,29 @@ _You can enable the following settings in Xcode by running [this script](resourc
724724
```
725725

726726
```
727-
// WRONG
727+
// WRONG. These complex attached macros should be written on the previous line.
728+
struct SolarSystemView {
729+
730+
@Query(sort: \.distance) var allPlanets: Planet
731+
732+
@Query(sort: \.age, order: .reverse) var moonsByAge: Moon
733+
734+
}
735+
736+
// RIGHT
737+
struct SolarSystemView {
738+
739+
@Query(sort: \.distance)
740+
var allPlanets: Planet
741+
742+
@Query(sort: \.age, order: .reverse)
743+
var oldestMoons: Moon
744+
745+
}
746+
```
747+
748+
```
749+
// WRONG. These long, complex attributes should be written on the previous line.
728750
struct RocketFactory {
729751

730752
@available(*, unavailable, message: "No longer in production") var saturn5Builder: Saturn5Builder

0 commit comments

Comments
 (0)