Contents

enumerate(_:batchSize:allowEscapingMutations:block:)

Runs a closure for each model that matches the criteria of the specified fetch descriptor.

Declaration

func enumerate<T>(_ fetch: FetchDescriptor<T>, batchSize: Int = 5000, allowEscapingMutations: Bool = false, block: (T) throws -> Void) throws where T : PersistentModel

Parameters

  • fetch:

    A fetch descriptor that provides the configuration for the fetch.

  • batchSize:

    The maximum number of models to include in each batch. The default value is 5000.

  • allowEscapingMutations:

    A Boolean value that determines whether the closure can leave the context in a modified state after it completes. The default value is false.

  • block:

    The closure to run for each fetched model.

See Also

Fetching models