objc2-ui-kit 0.3.2

Bindings to the UIKit 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::*;
#[cfg(feature = "objc2-core-data")]
use objc2_core_data::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimanageddocument?language=objc)
    #[unsafe(super(UIDocument, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "UIDocument")]
    pub struct UIManagedDocument;
);

#[cfg(feature = "UIDocument")]
extern_conformance!(
    unsafe impl NSFilePresenter for UIManagedDocument {}
);

#[cfg(feature = "UIDocument")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIManagedDocument {}
);

#[cfg(feature = "UIDocument")]
extern_conformance!(
    unsafe impl NSProgressReporting for UIManagedDocument {}
);

#[cfg(feature = "UIDocument")]
impl UIManagedDocument {
    extern_methods!(
        #[unsafe(method(persistentStoreName))]
        #[unsafe(method_family = none)]
        pub fn persistentStoreName(mtm: MainThreadMarker) -> Retained<NSString>;

        #[cfg(feature = "objc2-core-data")]
        #[unsafe(method(managedObjectContext))]
        #[unsafe(method_family = none)]
        pub fn managedObjectContext(&self) -> Retained<NSManagedObjectContext>;

        #[cfg(feature = "objc2-core-data")]
        #[unsafe(method(managedObjectModel))]
        #[unsafe(method_family = none)]
        pub fn managedObjectModel(&self) -> Retained<NSManagedObjectModel>;

        #[unsafe(method(persistentStoreOptions))]
        #[unsafe(method_family = none)]
        pub fn persistentStoreOptions(&self) -> Option<Retained<NSDictionary>>;

        /// Setter for [`persistentStoreOptions`][Self::persistentStoreOptions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `persistent_store_options` generic should be of the correct type.
        #[unsafe(method(setPersistentStoreOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPersistentStoreOptions(
            &self,
            persistent_store_options: Option<&NSDictionary>,
        );

        #[unsafe(method(modelConfiguration))]
        #[unsafe(method_family = none)]
        pub fn modelConfiguration(&self) -> Option<Retained<NSString>>;

        /// Setter for [`modelConfiguration`][Self::modelConfiguration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setModelConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setModelConfiguration(&self, model_configuration: Option<&NSString>);

        /// # Safety
        ///
        /// `store_options` generic should be of the correct type.
        #[unsafe(method(configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurePersistentStoreCoordinatorForURL_ofType_modelConfiguration_storeOptions_error(
            &self,
            store_url: &NSURL,
            file_type: &NSString,
            configuration: Option<&NSString>,
            store_options: Option<&NSDictionary>,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(persistentStoreTypeForFileType:))]
        #[unsafe(method_family = none)]
        pub fn persistentStoreTypeForFileType(&self, file_type: &NSString) -> Retained<NSString>;

        #[unsafe(method(readAdditionalContentFromURL:error:_))]
        #[unsafe(method_family = none)]
        pub fn readAdditionalContentFromURL_error(
            &self,
            absolute_url: &NSURL,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(additionalContentForURL:error:_))]
        #[unsafe(method_family = none)]
        pub fn additionalContentForURL_error(
            &self,
            absolute_url: &NSURL,
        ) -> Result<Retained<AnyObject>, Retained<NSError>>;

        /// # Safety
        ///
        /// `content` should be of the correct type.
        #[unsafe(method(writeAdditionalContent:toURL:originalContentsURL:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeAdditionalContent_toURL_originalContentsURL_error(
            &self,
            content: &AnyObject,
            absolute_url: &NSURL,
            absolute_original_contents_url: Option<&NSURL>,
        ) -> Result<(), Retained<NSError>>;
    );
}

/// Methods declared on superclass `UIDocument`.
#[cfg(feature = "UIDocument")]
impl UIManagedDocument {
    extern_methods!(
        #[unsafe(method(initWithFileURL:))]
        #[unsafe(method_family = init)]
        pub fn initWithFileURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UIDocument")]
impl UIManagedDocument {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}