registerCKShare(container:allowedSharingOptions:preparationHandler:)
Creates and registers a new collaboration object using a collection of records to share.
Declaration
func registerCKShare(container: CKContainer, allowedSharingOptions: CKAllowedSharingOptions = CKAllowedSharingOptions.standard, preparationHandler: @escaping @Sendable () async throws -> CKShare)Parameters
- container:
A Ckcontainer the system uses to coordinate all the interactions between your app and the server.
- allowedSharingOptions:
The Ckallowedsharingoptions. The standard option is the default.
- preparationHandler:
The handler the system calls in your app to create a new Ckshare.
Discussion
Use this method to share a collection of CKRecord objects that don’t have an existing CKShare assignment. When the system calls the preparationHandler, your app creates a new CKShare with the appropriate root CKRecord or CKRecordZone.ID.
After the server successfully saves the share, invoke the CKSharePreparationCompletionHandler with either the resulting CKShare, or an NSError if the save fails.
When the system invokes the share sheet with a CKShare that you register with this method, it prompts the user to start sharing.