Post

Replies

Boosts

Views

Activity

Multiple relationship variables of the the same type
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 } }
0
0
237
Jul ’24
Navigation Link
Trying to implement two NavigationLinks that navigate to the same View, but each Link changes a Bool in another class. I can't work out how to access that Bool in the Navigation Link code block. If anyone has any suggestions as to I complete this would be great. Thanks
0
0
306
Jul ’22