I'm looking to use a variable for the padding parameters but always seem to get an error reading "No exact matches in call to instance method 'padding'"
ForEach(allGames) { theGame in
var the_pad: [Edge.Set] = [.horizontal]
if theGame.name == "Game1" {
var the_pad: [Edge.Set] = [.horizontal,.top]
}
HStack{
...
}
.padding(the_pad)
}
This is the code without all the stuff in HStack (which has no problems), to keep it simple
This is for a menu and the top item gets cut off at the top hence it needs padding but the other menu items have better spacing without it.
Yes, I got it to work using an if-else statement and 2 different HStacks, but I'm trying to learn and I'm wondering what I'm doing wrong.