2

I am looking to have multiple columns within a SwiftUI form section. I have seen other potential fixes and using .onTapGesture, but that seem's very 'hacky' and doesn't provide the same aesthetics a form normally does on the iPad.

In my code I have one ForEach loop that will have around 15 rows, I want to split these and ensure they all appear on the user's screen at once, therefore eliminating the need to scroll and search.

Section(header: Text("Current Players On the Field")){
    ForEach(team.players){player in
        if(player.active == true){
            Button(action: {
                //Button Action Here          
            }){
                PlayerSelectTemplate(player: player)
            }
            .padding(5)
        }
    }
}

I have tried implementing LazyV/LazyH Grids in but the buttons all seem to merge and become one, making the separate buttons completely redundant.

As mentioned above, I want to try and avoid the .onTapGesture solve, as it doesn't look as good as having individual buttons. Any ideas?

pawello2222
  • 46,897
  • 22
  • 145
  • 209
benpomeroy9
  • 375
  • 5
  • 21

0 Answers0