If card is matched, it disapears
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user