objc2-foundation 0.3.2

Bindings to the Foundation 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 crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensioncontext?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSExtensionContext;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSExtensionContext {}
);

impl NSExtensionContext {
    extern_methods!(
        #[cfg(feature = "NSArray")]
        #[unsafe(method(inputItems))]
        #[unsafe(method_family = none)]
        pub fn inputItems(&self) -> Retained<NSArray>;

        #[cfg(all(feature = "NSArray", feature = "block2"))]
        /// # Safety
        ///
        /// - `items` generic should be of the correct type.
        /// - `completion_handler` block must be sendable.
        #[unsafe(method(completeRequestReturningItems:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn completeRequestReturningItems_completionHandler(
            &self,
            items: Option<&NSArray>,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(feature = "NSError")]
        #[unsafe(method(cancelRequestWithError:))]
        #[unsafe(method_family = none)]
        pub fn cancelRequestWithError(&self, error: &NSError);

        #[cfg(all(feature = "NSURL", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` block must be sendable.
        #[unsafe(method(openURL:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn openURL_completionHandler(
            &self,
            url: &NSURL,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSExtensionContext {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for NSExtensionContext {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionitemsanderrorskey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSExtensionItemsAndErrorsKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostwillenterforegroundnotification?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSExtensionHostWillEnterForegroundNotification: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostdidenterbackgroundnotification?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSExtensionHostDidEnterBackgroundNotification: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostwillresignactivenotification?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSExtensionHostWillResignActiveNotification: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostdidbecomeactivenotification?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSExtensionHostDidBecomeActiveNotification: Option<&'static NSString>;
}