<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIWindowSceneDelegate/windowScene(_:userDidAcceptCloudKitShareWith:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIWindowSceneDelegate(im)windowScene:userDidAcceptCloudKitShareWithMetadata:"
  },
  "title" : "windowScene(_:userDidAcceptCloudKitShareWith:)"
}
-->

# windowScene(_:userDidAcceptCloudKitShareWith:)

Tells the delegate that the window scene now has access to shared information in CloudKit.

```
optional func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShareMetadata)
```

## Parameters

`windowScene`

The window scene object receiving the metadata.

`cloudKitShareMetadata`

Information about the CloudKit data that is now available to the app. Use this object to retrieve information about the <doc://com.apple.documentation/documentation/CloudKit/CKShare> object and the associated records.

## Discussion

Use this method to respond to a CloudKit Sharing invitation. In your implementation, accept the share by scheduling a <doc://com.apple.documentation/documentation/CloudKit/CKAcceptSharesOperation> object that contains the metadata object in the `cloudKitShareMetadata` parameter. After your operation object finishes successfully, you can begin fetching records and incorporating the resulting data into your app. Alternatively, if your app uses Core Data and <doc://com.apple.documentation/documentation/CoreData/NSPersistentCloudKitContainer>, accept the share by calling the container’s <doc://com.apple.documentation/documentation/CoreData/NSPersistentCloudKitContainer/acceptShareInvitationsFromMetadata:intoPersistentStore:completion:> method.

> Note:
> To use this method in a SwiftUI app, you must first add scene and application delegates to your project and configure your app to use them. For more information, see <doc://com.apple.documentation/documentation/CoreData/accepting-share-invitations-in-a-swiftui-app>.

The system calls this method only when your app is running and has an existing scene. If your app isn’t running, the system includes the share metadata in the [`UIScene.ConnectionOptions`](/documentation/UIKit/UIScene/ConnectionOptions) object it passes to the [`init(session:connectionOptions:)`](/documentation/UIKit/UIScene/init(session:connectionOptions:)) method when it creates your app’s first scene.

---

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)