Skip to content

Conversation

@calda
Copy link
Collaborator

@calda calda commented Dec 19, 2025

Quick prototype for a rule to remove redundant SwiftUI Groups:

  struct MyView: View {
    var body: some View {
-     Group {
        Text("foo")
        Text("bar")
-     }
    }
  }
  struct MyView: View {
+   @ViewBuilder
    var content: some View {
-     Group {
        Text("foo")
        Text("bar")
-     }
    }
  }

Code by Claude, I haven't reviewed or polished it, but did test it on our codebase as a proof of concept. It finds and updates lots of examples.

@calda
Copy link
Collaborator Author

calda commented Dec 19, 2025

Just bookmarking the code with a draft PR, will revist some time next year

@calda calda closed this Dec 19, 2025
@calda calda changed the title Add redundantSwiftUIGroup rule Prototype redundantSwiftUIGroup rule Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant