When I try to iterate over Identifiable struct var with foreach loop nested with other foreach lop taking structs attribute say array and representing it as button in ui then only last iterated item from array is enabled. Code struct Player { let id : Int var birth: Piece }
struct Piece { let id: Int var moves: Int }
ForEach($players, id: .id) { player in let pl: Player = player.wrappedValue ForEach(pl.birth, id: .id) { bp in OverlayBirthPieces(cur_pl: player, movingpiece: .constant(bp), color: pl.color) } }
I want all the pl.birth item (pieces on Ludo board) to be enabled if player.chance == true. but only last birthplace is getting enabled