ObjectiveRecord icon indicating copy to clipboard operation
ObjectiveRecord copied to clipboard

Consider making NSPredicates API public?

Open DenTelezhkin opened this issue 12 years ago • 5 comments

First of all, thanks for really awesome framework, it looks much better than monstrous MagicalRecord.

I'm using ObjectiveRecord in one of my project, and it takes advantage of NSFetchedResultsController to display data in UITableView and UICollectionView. Now most ActiveRecord style methods allow to fetch data from CoreData, but we don't need that with NSFetchedResultsController.

I could, of course, define private category, and just use private method of ObjectiveRecord, but that's probably not good. It could be great, if ObjectiveRecord provided a way to get NSPredicates from fancy where: methods.

DenTelezhkin avatar Jan 28 '14 16:01 DenTelezhkin

There's work being done for 2.0 to support just this.

stephencelis avatar Mar 26 '14 19:03 stephencelis

@stephencelis we can still take a look if it's possible to simply add it to 1.x. Of course, if it won't bloat the whole thing

supermarin avatar Mar 26 '14 19:03 supermarin

@supermarin We could add - (NSPredicate *)wherePredicateFor:(id)condition, or something more suitably named. It doesn't seem as clean of an API, though, and it would likely be dropped for the next big release. Thoughts?

stephencelis avatar Mar 26 '14 19:03 stephencelis

Oh crap, sorry i've totally misread this. Not sure if we should expose predicates in the current api; I was thinking about a method that returns you a generated NSFetchedResultsController

supermarin avatar Mar 26 '14 20:03 supermarin

@supermarin Yeah, that would be ideal, but without the query builder on the 2.0 branch, there would be a lot of class-level API bloat.

stephencelis avatar Mar 26 '14 20:03 stephencelis