I have two models that I want to store in a realm database. They are team and player. Each team will have x number of players and I want these to be accessible through the team. E.g. the user selects a team and then any corresponding players. I want the user in the end to be able to create a new team, create new players and assign players to a team
class Team: Object{
@objc dynamic var teamName: String = ""
@objc dynamic var players: [Player] = []
}
class Player: Object{
@objc dynamic var playerName: String = ""
@objc dynamic var shirtNumber: Int = 0
}
How would I then look at accessing these new models and more specifically, what would be a good way of iterating through the teams, and then the players inside.
I am very new to Realm and the concepts of databases inside my app so not really sure where to start