I have three model in CoreData
:
- Category with categoryId
- Production with productionId
- SubProduction with subProductionId
SubProduction is related to One Production and every product has Many SubProduction
Production is related to One Category and every Category has Many Production
I want to get all SubProduction of a Category by categoryId.
I know this way: Load all productions of category and by a for loop get all SubProductions. I'm wondering if there is a better way to approach it by NSPredicate
How to make this NSPredicate
format?
Something like this:
frc.fetchRequest.predicate = NSPredicate(format: "production.category = %@", category)
WOW, I just test my imagine and
It's work:
Thanks to
NSPredicate