Instance Method

enumerateObjectsWithOptions:usingBlock:

Executes the specified block using each object in the fetch result.

Declaration

- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(ObjectType obj, NSUInteger idx, BOOL *stop))block;

Parameters

opts

A bit mask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

block

The block to apply to elements in the fetch result.

The block takes three parameters:

obj

The element in the fetch result.

idx

The index of the element in the fetch result.

stop

A pointer to a Boolean value. Set *stop to YES within the block to cancel further processing of the fetch result.

Discussion

By default, the enumeration starts with the first object and continues in order through the fetch result to the last element specified by the index set. Specify the NSEnumerationConcurrent or NSEnumerationReverse options to modify this behavior.

This method executes synchronously.

See Also

Performing Operations with Objects in a Fetch Result

- enumerateObjectsAtIndexes:options:usingBlock:

Executes the specified block using the objects in the fetch result at the specified indexes.

- enumerateObjectsUsingBlock:

Executes the specified block using each object in the fetch result, starting with the first object and continuing in order to the last object.