objc2-cloud-kit 0.3.2

Bindings to the CloudKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharepreparationcompletionhandler?language=objc)
#[cfg(all(feature = "CKRecord", feature = "CKShare", feature = "block2"))]
pub type CKSharePreparationCompletionHandler =
    *mut block2::DynBlock<dyn Fn(*mut CKShare, *mut NSError)>;

/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharepreparationhandler?language=objc)
#[cfg(all(feature = "CKRecord", feature = "CKShare", feature = "block2"))]
pub type CKSharePreparationHandler =
    *mut block2::DynBlock<dyn Fn(CKSharePreparationCompletionHandler)>;

mod private_NSItemProviderCKSharingSupport {
    pub trait Sealed {}
}

/// Category "CKSharingSupport" on [`NSItemProvider`].
#[doc(alias = "CKSharingSupport")]
pub unsafe trait NSItemProviderCKSharingSupport:
    ClassType + Sized + private_NSItemProviderCKSharingSupport::Sealed
{
    extern_methods!(
        #[cfg(all(
            feature = "CKAllowedSharingOptions",
            feature = "CKContainer",
            feature = "CKRecord",
            feature = "CKShare",
            feature = "block2"
        ))]
        /// Use this method when you want to share a collection of
        /// `CKRecords`but don't currently have a
        /// `CKShare.`When the
        /// `preparationHandler`is called, you should create a new
        /// `CKShare`with the appropriate root
        /// `CKRecord`or
        /// `CKRecordZoneID.`After ensuring the share and all records have been saved to the server, invoke the
        /// `preparationCompletionHandler`with either the resulting
        /// `CKShare,`or an
        /// `NSError`if saving failed. Invoking the share sheet with a
        /// `CKShare`registered with this method will prompt the user to start sharing.
        ///
        /// # Safety
        ///
        /// `preparation_handler` must be a valid pointer.
        #[unsafe(method(registerCKShareWithContainer:allowedSharingOptions:preparationHandler:))]
        #[unsafe(method_family = none)]
        unsafe fn registerCKShareWithContainer_allowedSharingOptions_preparationHandler(
            &self,
            container: &CKContainer,
            allowed_options: &CKAllowedSharingOptions,
            preparation_handler: CKSharePreparationHandler,
        );

        #[cfg(all(
            feature = "CKAllowedSharingOptions",
            feature = "CKContainer",
            feature = "CKRecord",
            feature = "CKShare"
        ))]
        /// Use this method when you have a
        /// `CKShare`that is already saved to the server. Invoking the share sheet with a
        /// `CKShare`registered with this method will allow the owner to make modifications to the share settings, or will allow a participant to view the share settings.
        #[unsafe(method(registerCKShare:container:allowedSharingOptions:))]
        #[unsafe(method_family = none)]
        unsafe fn registerCKShare_container_allowedSharingOptions(
            &self,
            share: &CKShare,
            container: &CKContainer,
            allowed_options: &CKAllowedSharingOptions,
        );
    );
}

impl private_NSItemProviderCKSharingSupport::Sealed for NSItemProvider {}
unsafe impl NSItemProviderCKSharingSupport for NSItemProvider {}