Contents

prepareShare(container:allowedSharingOptions:preparationHandler:)

Creates a share when the system calls the specified handler.

Declaration

static func prepareShare(container: CKContainer, allowedSharingOptions: CKAllowedSharingOptions = CKAllowedSharingOptions.standard, preparationHandler: @escaping  @Sendable () async throws -> CKShare) -> CKShareTransferRepresentation<Item>.ExportedShare

Parameters

Return Value

The CKShareTransferRepresentation.ExportedShare with the new CKShare.

Discussion

Use this method when you want to share a collection of CKRecord objects, but don’t currently have a CKShare.

When the system calls the preparationHandler, create a new CKShare with the appropriate root CKRecord or CKRecordZone.ID.

After saving the share and all records to the server, return the resulting CKShare or throw an error if saving fails. When your app invokes the share sheet with a CKShare registered with this method, the system prompts the user to start sharing.

See Also

Preparing an exported share