Keeping CoreData Objects in sync

I’ve just about got my app to a point where I’m starting to use multiple CoreData objects and just wondering how you should keep them in sync.

For instance I have a Team Entity, it has a name property @NSManaged var name: String and I also have a relationship @NSManaged var players: NSSet?.

I have a Player Entity and it has a attribute @NSManaged var team: String - I think this might be a mistake as I also have the inverse relationship @NSManaged var playerTeam: Team? Is it?

When I load my my Team and click on it, I am using the predicate statement

let predicate = NSPredicate(format: "team = %@",

I find that if I have a team 0f 5 players and then I edit my Team Name, the save works but my teams players are then not visible when I go into that team’s players screen. Assumably because i’ve used the team attribute as a predicate and now the actual Team has a new name, but this hasn’t been reflected in the Player’s attribute name.

I can understand why that is the case, I guess my question is how should I be keeping these in sync, should I be getting rid of the attribute that was just the String representation of the team’s name and if so, is there a way to predicate by relationship? (Hope that makes sense)