If card is matched, it disapears

This commit is contained in:
2023-08-17 11:58:15 +02:00
parent b80723c964
commit 448a4c9401
2 changed files with 5 additions and 3 deletions

View File

@@ -20,7 +20,11 @@ class SetGameModelView: ObservableObject {
} }
var cardsOnTable: Array<Card> { var cardsOnTable: Array<Card> {
model.displayedCards model.displayedCards.filter(showCard)
}
private func showCard(card: SetGameModelView.Card) -> Bool {
!card.isMatched
} }
func newGame() { func newGame() {

View File

@@ -78,8 +78,6 @@ struct CardView: View {
cardShape.aspectRatio(2/3, contentMode: .fit) cardShape.aspectRatio(2/3, contentMode: .fit)
if (card.isSelected) { if (card.isSelected) {
cardShape.foregroundColor(selectedGreen) cardShape.foregroundColor(selectedGreen)
} else if (card.isMatched) {
cardShape.foregroundColor(colors[card.matchId])
} else { } else {
cardShape.foregroundColor(.white) cardShape.foregroundColor(.white)
} }