objc2_foundation/generated/
NSExtensionContext.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensioncontext?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSExtensionContext;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for NSExtensionContext {}
18);
19
20impl NSExtensionContext {
21    extern_methods!(
22        #[cfg(feature = "NSArray")]
23        #[unsafe(method(inputItems))]
24        #[unsafe(method_family = none)]
25        pub fn inputItems(&self) -> Retained<NSArray>;
26
27        #[cfg(all(feature = "NSArray", feature = "block2"))]
28        /// # Safety
29        ///
30        /// - `items` generic should be of the correct type.
31        /// - `completion_handler` block must be sendable.
32        #[unsafe(method(completeRequestReturningItems:completionHandler:))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn completeRequestReturningItems_completionHandler(
35            &self,
36            items: Option<&NSArray>,
37            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
38        );
39
40        #[cfg(feature = "NSError")]
41        #[unsafe(method(cancelRequestWithError:))]
42        #[unsafe(method_family = none)]
43        pub fn cancelRequestWithError(&self, error: &NSError);
44
45        #[cfg(all(feature = "NSURL", feature = "block2"))]
46        /// # Safety
47        ///
48        /// `completion_handler` block must be sendable.
49        #[unsafe(method(openURL:completionHandler:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn openURL_completionHandler(
52            &self,
53            url: &NSURL,
54            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
55        );
56    );
57}
58
59/// Methods declared on superclass `NSObject`.
60impl NSExtensionContext {
61    extern_methods!(
62        #[unsafe(method(init))]
63        #[unsafe(method_family = init)]
64        pub fn init(this: Allocated<Self>) -> Retained<Self>;
65
66        #[unsafe(method(new))]
67        #[unsafe(method_family = new)]
68        pub fn new() -> Retained<Self>;
69    );
70}
71
72impl DefaultRetained for NSExtensionContext {
73    #[inline]
74    fn default_retained() -> Retained<Self> {
75        Self::new()
76    }
77}
78
79extern "C" {
80    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionitemsanderrorskey?language=objc)
81    #[cfg(feature = "NSString")]
82    pub static NSExtensionItemsAndErrorsKey: Option<&'static NSString>;
83}
84
85extern "C" {
86    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostwillenterforegroundnotification?language=objc)
87    #[cfg(feature = "NSString")]
88    pub static NSExtensionHostWillEnterForegroundNotification: Option<&'static NSString>;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostdidenterbackgroundnotification?language=objc)
93    #[cfg(feature = "NSString")]
94    pub static NSExtensionHostDidEnterBackgroundNotification: Option<&'static NSString>;
95}
96
97extern "C" {
98    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostwillresignactivenotification?language=objc)
99    #[cfg(feature = "NSString")]
100    pub static NSExtensionHostWillResignActiveNotification: Option<&'static NSString>;
101}
102
103extern "C" {
104    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsextensionhostdidbecomeactivenotification?language=objc)
105    #[cfg(feature = "NSString")]
106    pub static NSExtensionHostDidBecomeActiveNotification: Option<&'static NSString>;
107}