<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TipKit",
  "identifier" : "/documentation/TipKit/Tips/ConfigurationOption/cloudKitContainer(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "TipKit"
    ],
    "preciseIdentifier" : "s:6TipKit4TipsO19ConfigurationOptionV05cloudB9ContaineryA2E05CloudbG0VSgFZ"
  },
  "title" : "cloudKitContainer(_:)"
}
-->

# cloudKitContainer(_:)

Sets the CloudKit container used for syncing tips.

```
static func cloudKitContainer(_ cloudKitContainer: Tips.ConfigurationOption.CloudKitContainer?) -> Tips.ConfigurationOption
```

## Parameters

`cloudKitContainer`

The option to use for specifying TipKit’s CloudKit datastore. Use `nil` to disable CloudKit syncing.

## Overview

Use `cloudKitContainer` to sync TipKit’s datastore across devices.

In order to avoid record collisions between your app and TipKit, it is recommended that you
use a separate container for syncing tips.

By default, TipKit’s datastore does not sync with CloudKit.

## Discussion

Syncing TipKit’s datastore requires two separate capabilities in your app’s entitlements:
the iCloud capability which lets you specify a CloudKit container, and the Background Modes
capability, which lets your app receive remote notifications from CloudKit that contain information
about new changes on the server.

![A screenshot of Xcode showing the entitlements for enabling TipKit's CloudKit syncing.](images/com.apple.TipKit/xcode_cloudkit_entitlements@2x.png)

```swift
@main
struct TipKitTrails: App {
    init() {
        do {
            // Sync the TipKit datastore using CloudKit.
            try Tips.configure([
                .cloudKitContainer(.named("iCloud.com.apple.TipKitTrails.tips"))
            ])
        }
        catch {
            // Handle TipKit errors
            print("Error initializing TipKit \(error.localizedDescription)")
        }
    }
}
```

### CloudKit Container Values

[`automatic`](/documentation/TipKit/Tips/ConfigurationOption/CloudKitContainer/automatic)

Syncs the TipKit datastore using the first container in your app’s entitlements
with a “.tips” suffix or, if none is available, the primary container is used.

[`named(_:)`](/documentation/TipKit/Tips/ConfigurationOption/CloudKitContainer/named(_:))

Syncs the TipKit datastore using the specified CloudKit container.



---

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)