Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SwiftUI properties sort #289

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fetch latest release
  • Loading branch information
Miguel Jimenez committed Aug 22, 2024
commit 4ac03070e2f87fe1439544ea73425d82314934de
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ let package = Package(

.binaryTarget(
name: "swiftformat",
url: "https://github.com/calda/SwiftFormat/releases/download/0.55-beta-11/SwiftFormat.artifactbundle.zip",
checksum: "421884ecccc34b75135e9aa4b80e21ee6d9985084896fe8d58e07b28d9a2e0f6"),
url: "https://github.com/calda/SwiftFormat/releases/download/0.55-beta-12/SwiftFormat.artifactbundle.zip",
checksum: "8783cefc0837416759f81064df7907cc60ddca6d3f8c3b301b123a2193a8585b"),

.binaryTarget(
name: "SwiftLintBinary",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4002,7 +4002,7 @@ _You can enable the following settings in Xcode by running [this script](resourc
}
```

Additioanlly, after grouping SwiftUI properties, its prefered that propeties are sorted by their dynamic property type. The order is determined by the first time a type appears:
Additioanlly, after grouping SwiftUI properties, its preferred that properties are sorted by their dynamic property type. The order is determined by the first time a type appears:

```swift
// WRONG
Expand Down
1 change: 1 addition & 0 deletions Sources/AirbnbSwiftFormatTool/airbnb.swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
--typeattributes prev-line # wrapAttributes
--wrapternary before-operators # wrap
--structthreshold 20 # organizeDeclarations
--sortswiftuiprops first-appearance-sort
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calda I noticed there is a #something at the end of each, not sure what to add here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the name of the rule that uses the argument, so:

Suggested change
--sortswiftuiprops first-appearance-sort
--sortswiftuiprops first-appearance-sort #organizeDeclarations

Copy link
Member

@calda calda Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put this lower down below the --typeorder option

--enumthreshold 20 # organizeDeclarations
--organizetypes class,struct,enum,extension,actor # organizeDeclarations
--visibilityorder beforeMarks,instanceLifecycle,open,public,package,internal,fileprivate,private # organizeDeclarations
Expand Down
Loading