modo-studio / SugarRecord

CoreData/Realm sweet wrapper written in Swift
MIT License
2.11k stars 223 forks source link

Adding Count operation to Context #334

Open LuizZak opened 7 years ago

LuizZak commented 7 years ago

Short description

Adds a method Context.count<T> and implement it in the NSManagedObjectContext extension.

Solution

Counting number of results without getting the objects is a useful functionality, specially when the objects are heavy-weight to fetch simply to be counted and then discarded.

Implementation

GIF

CoreData with brand new count method:

200

...that gives 02 (two) UserEntity instances.