Contents

perform(_:inZoneWith:completionHandler:)

Searches for records matching a predicate in the specified record zone.

Declaration

func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?, completionHandler: @escaping  @Sendable ([CKRecord]?, (any Error)?) -> Void)
func perform(_ query: CKQuery, inZoneWith zoneID: CKRecordZone.ID?) async throws -> [CKRecord]

Parameters

  • query:

    The query that contains the search parameters. For more information, see Ckquery.

  • zoneID:

    The identifier of the record zone to search. If you’re searching a shared database, provide a record zone identifier; otherwise, you can specify nil to search all record zones in the database.

  • completionHandler:

    The closure to execute with the search results.

Discussion

The completion handler takes the following parameters:

  • The records that match the specified query, or nil if there’s an error.

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

For information on a more convenient way to search a database, see records(matching:inZoneWith:desiredKeys:resultsLimit:).

See Also

Querying Records