---
title: "init(pendingChanges:recordProvider:)"
framework: cloudkit
role: symbol
role_heading: Initializer
path: "cloudkit/cksyncengine-5sie5/recordzonechangebatch/init(pendingchanges:recordprovider:)"
---

# init(pendingChanges:recordProvider:)

Creates a batch of records to modify using the provided record zone changes.

## Declaration

```swift
init?(pendingChanges: [CKSyncEngine.PendingRecordZoneChange], recordProvider: @Sendable (CKRecord.ID) async -> CKRecord?) async
```

## Parameters

- `pendingChanges`: The record zone changes to process.
- `recordProvider`: A closure that returns the record for the specified record identifier.

## Return Value

Return Value The batch of records to modify, or nil if there are no pending changes.

## Discussion

Discussion This method iterates over pendingChanges and adds the necessary information to the new batch, until there are no more changes or the size of the batch reaches the maximum limit. If the type of change is a record save, the method asks the specified recordProvider closure for that record. If the closure returns nil, the method skips that change.

## See Also

### Creating a batch

- [CKSyncEngine.PendingRecordZoneChange](cloudkit/cksyncengine-5sie5/pendingrecordzonechange.md)
- [init(recordsToSave:recordIDsToDelete:atomicByZone:)](cloudkit/cksyncengine-5sie5/recordzonechangebatch/init(recordstosave:recordidstodelete:atomicbyzone:).md)
