I am frequently setting up fetch requests in multiple classes to retrieve 'allRecipes
', or a 'lastModifiedDate
' from core data (plus a few other results).
It would be convenient to use a specialized category, NSManagedObjectContext+RecipeAppConveniences
, for this. I don't really need to make this generic, I will just decide on a case by case basis if I am fetching the same thing frequently enough that it would be useful in the category.
Is this a standard practice? I haven't used categories much and just wanted to check it's not an anti-pattern, and that I'm not overlooking something that will cause me pain down the line.
It is not going to be an anti-pattern, if you think that will make your code generic, readable you can go for it.
It was added to objective-c just for this flexibility.