Contents

fetch(withRecordID:completionHandler:)

Fetches a specific record.

Declaration

func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping  @Sendable (CKRecord?, (any Error)?) -> Void)
func record(for recordID: CKRecord.ID) async throws -> CKRecord

Parameters

  • recordID:

    The identifier of the record to fetch.

  • completionHandler:

    The closure to execute with the fetch results.

Discussion

The completion handler takes the following parameters:

  • The requested record, or nil if CloudKit can’t provide that record.

  • An error if a problem occurs, or nil if the fetch completes successfully.

For information on a more convenient way to fetch specific records, see records(for:desiredKeys:).

See Also

Fetching Records