setsOfCardsByLevel is an array of cards.
Every card has a level.
I want to remove all cards from array if their level is equal to level from the parameter.
Here is my function:
func removeCardsByLevel(_ level: Int) {
for card in setsOfCards {
if card.level == level {
setsOfCards.remove // HOW?
}
}
}
Advices? Ideas?
If I understand you correctly, you wish to remove the cards that matches a certain level?
setsOfCards.removeAll { $0.level == level }