<!--
{
  "availability" : [
    "iOS: 15.0.0 - 15.0.0",
    "iPadOS: 15.0.0 - 15.0.0",
    "macCatalyst: 15.0.0 - 15.0.0",
    "macOS: 12.0.0 - 12.0.0",
    "tvOS: 15.0.0 - 15.0.0",
    "visionOS: -",
    "watchOS: 8.0.0 - 8.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKDatabase/perform(_:inZoneWith:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So10CKDatabaseC8CloudKitE7perform_10inZoneWithSaySo8CKRecordCGSo7CKQueryC_So0hF2IDCSgtYaKF"
  },
  "title" : "perform(_:inZoneWith:)"
}
-->

# perform(_:inZoneWith:)

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

```
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`](/documentation/CloudKit/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.

## Return Value

The records that match the specified query.

## Discussion

For information on a more convenient way to search a database, see [`records(matching:inZoneWith:desiredKeys:resultsLimit:)`](/documentation/CloudKit/CKDatabase/records(matching:inZoneWith:desiredKeys:resultsLimit:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)