windowScene(_:userDidAcceptCloudKitShareWith:)
Tells the delegate that the window scene now has access to shared information in CloudKit.
Declaration
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 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 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 NSPersistentCloudKitContainer, accept the share by calling the container’s acceptShareInvitationsFromMetadata:intoPersistentStore:completion: method.
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 object it passes to the init(session:connectionOptions:) method when it creates your app’s first scene.