fetch(withRecordZoneIDs:completionHandler:)
Fetches the specified record zones and delivers them to a completion handler.
Declaration
@preconcurrency func fetch(withRecordZoneIDs zoneIDs: [CKRecordZone.ID], completionHandler: @escaping @Sendable (Result<[CKRecordZone.ID : Result<CKRecordZone, any Error>], any Error>) -> Void)Parameters
- zoneIDs:
The identifiers of the record zones to fetch.
- completionHandler:
The closure to execute with the fetch results.
Discussion
The completion handler takes the following parameters:
A Result that contains either a dictionary of fetched record zones, or an error if the request fails, such as when the network is unavailable or the device doesn’t have an active iCloud account. When present, the dictionary uses the identifiers you specify in
zoneIDsas its keys. The value of each key is a Result that contains either the corresponding fetched record zone, or an error that describes why CloudKit can’t provide that record zone.
For information on a more configurable way to fetch specific record zones, see CKFetchRecordZonesOperation.