I have a CoreData Entity named List it has a Relationship to an Entity Address. This is a one-to-many relationship seeing as an Address can be only be one List.
Address entities have an Attribute flag which is an Integer 16.
Is there a way for me to define a Fetched Property in the List entity with a count of all related Address entities that have their flag set to 1? What would the predicate look like?
Thanks
Yes, you can do it like this:
Create a fetch request for the
Listentity and set its predicate to:[NSPredicate predicateWithFormat:@"address.flag == %@", @1]Also don't forget to prefetch relationship so you don't encounter any cache misses.