supermarin / ObjectiveRecord

ActiveRecord-like API for CoreData
MIT License
1.29k stars 194 forks source link

Consider making NSPredicates API public? #71

Open DenTelezhkin opened 10 years ago

DenTelezhkin commented 10 years ago

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.

stephencelis commented 10 years ago

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

supermarin commented 10 years ago

@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

stephencelis commented 10 years ago

@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?

supermarin commented 10 years ago

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

stephencelis commented 10 years ago

@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.