---
title: "database(with:)"
framework: cloudkit
role: symbol
role_heading: Instance Method
path: "cloudkit/ckcontainer/database(with:)"
---

# database(with:)

Returns the database with the specified scope.

## Declaration

```swift
func database(with databaseScope: CKDatabase.Scope) -> CKDatabase
```

## Parameters

- `databaseScope`: The database’s scope. See doc://com.apple.cloudkit/documentation/CloudKit/CKDatabase/Scope for the available options.

## See Also

### Getting the Public and Private Databases

- [privateCloudDatabase](cloudkit/ckcontainer/privateclouddatabase.md)
- [publicCloudDatabase](cloudkit/ckcontainer/publicclouddatabase.md)
- [sharedCloudDatabase](cloudkit/ckcontainer/sharedclouddatabase.md)
