Skip to content

Comments

Adding Count operation to Context#334

Open
LuizZak wants to merge 1 commit intomodo-studio:masterfrom
LuizZak:count
Open

Adding Count operation to Context#334
LuizZak wants to merge 1 commit intomodo-studio:masterfrom
LuizZak:count

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.

1 participant