Want to know if it's possible to have multiple variables of the same type? This code works but when the app loads the data again on relaunch, both variables have both the new cards and discarded cards.
@Model class Player { let id = UUID() let name: String @Relationship(deleteRule: .cascade, inverse: \Card.player) var cards: [Card] = [] @Relationship(deleteRule: .cascade, inverse: \Card.player) var discardedCards: [Card] = []
init(name: String, cards: [Card]) {
self.name = name
self.cards = cards
}
}
@Model class Card { let id = UUID() let name: String var player: Player?
init(name: String) {
self.name = name
}
}