Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Count operation to Context #334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LuizZak
Copy link
Contributor

@LuizZak LuizZak commented Jun 4, 2017

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

  • [√] Add new protocol method Context.count<T: Entity>(_:) throws -> Int;
  • [√] Implement this protocol on existing extension of NSManagedObjectContext with other protocol requirements.

GIF

CoreData with brand new count method:

200

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant