objc2_ui_kit/generated/
UICloudSharingController.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-cloud-kit")]
7use objc2_cloud_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UICloudSharingPermissionOptions(pub NSUInteger);
17bitflags::bitflags! {
18 impl UICloudSharingPermissionOptions: NSUInteger {
19 #[doc(alias = "UICloudSharingPermissionStandard")]
20 const Standard = 0;
21 #[doc(alias = "UICloudSharingPermissionAllowPublic")]
22 const AllowPublic = 1<<0;
23 #[doc(alias = "UICloudSharingPermissionAllowPrivate")]
24 const AllowPrivate = 1<<1;
25 #[doc(alias = "UICloudSharingPermissionAllowReadOnly")]
26 const AllowReadOnly = 1<<2;
27 #[doc(alias = "UICloudSharingPermissionAllowReadWrite")]
28 const AllowReadWrite = 1<<3;
29 }
30}
31
32unsafe impl Encode for UICloudSharingPermissionOptions {
33 const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UICloudSharingPermissionOptions {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_protocol!(
41 pub unsafe trait UICloudSharingControllerDelegate:
43 NSObjectProtocol + MainThreadOnly
44 {
45 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
46 #[unsafe(method(cloudSharingController:failedToSaveShareWithError:))]
47 #[unsafe(method_family = none)]
48 fn cloudSharingController_failedToSaveShareWithError(
49 &self,
50 csc: &UICloudSharingController,
51 error: &NSError,
52 );
53
54 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
55 #[unsafe(method(itemTitleForCloudSharingController:))]
56 #[unsafe(method_family = none)]
57 fn itemTitleForCloudSharingController(
58 &self,
59 csc: &UICloudSharingController,
60 ) -> Option<Retained<NSString>>;
61
62 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
63 #[optional]
64 #[unsafe(method(itemThumbnailDataForCloudSharingController:))]
65 #[unsafe(method_family = none)]
66 fn itemThumbnailDataForCloudSharingController(
67 &self,
68 csc: &UICloudSharingController,
69 ) -> Option<Retained<NSData>>;
70
71 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
72 #[optional]
73 #[unsafe(method(itemTypeForCloudSharingController:))]
74 #[unsafe(method_family = none)]
75 fn itemTypeForCloudSharingController(
76 &self,
77 csc: &UICloudSharingController,
78 ) -> Option<Retained<NSString>>;
79
80 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
81 #[optional]
82 #[unsafe(method(cloudSharingControllerDidSaveShare:))]
83 #[unsafe(method_family = none)]
84 fn cloudSharingControllerDidSaveShare(&self, csc: &UICloudSharingController);
85
86 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
87 #[optional]
88 #[unsafe(method(cloudSharingControllerDidStopSharing:))]
89 #[unsafe(method_family = none)]
90 fn cloudSharingControllerDidStopSharing(&self, csc: &UICloudSharingController);
91 }
92);
93
94extern_class!(
95 #[unsafe(super(UIViewController, UIResponder, NSObject))]
97 #[thread_kind = MainThreadOnly]
98 #[derive(Debug, PartialEq, Eq, Hash)]
99 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
100 pub struct UICloudSharingController;
101);
102
103#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
104extern_conformance!(
105 unsafe impl NSCoding for UICloudSharingController {}
106);
107
108#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
109extern_conformance!(
110 unsafe impl NSObjectProtocol for UICloudSharingController {}
111);
112
113#[cfg(all(
114 feature = "UIAppearance",
115 feature = "UIResponder",
116 feature = "UIViewController"
117))]
118extern_conformance!(
119 unsafe impl UIAppearanceContainer for UICloudSharingController {}
120);
121
122#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
123extern_conformance!(
124 unsafe impl UIContentContainer for UICloudSharingController {}
125);
126
127#[cfg(all(
128 feature = "UIFocus",
129 feature = "UIResponder",
130 feature = "UIViewController"
131))]
132extern_conformance!(
133 unsafe impl UIFocusEnvironment for UICloudSharingController {}
134);
135
136#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
137extern_conformance!(
138 unsafe impl UIResponderStandardEditActions for UICloudSharingController {}
139);
140
141#[cfg(all(
142 feature = "UIResponder",
143 feature = "UITraitCollection",
144 feature = "UIViewController"
145))]
146extern_conformance!(
147 unsafe impl UITraitEnvironment for UICloudSharingController {}
148);
149
150#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
151impl UICloudSharingController {
152 extern_methods!(
153 #[unsafe(method(initWithNibName:bundle:))]
154 #[unsafe(method_family = init)]
155 pub unsafe fn initWithNibName_bundle(
156 this: Allocated<Self>,
157 nib_name_or_nil: Option<&NSString>,
158 nib_bundle_or_nil: Option<&NSBundle>,
159 ) -> Retained<Self>;
160
161 #[unsafe(method(initWithCoder:))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn initWithCoder(
167 this: Allocated<Self>,
168 coder: &NSCoder,
169 ) -> Option<Retained<Self>>;
170
171 #[cfg(all(feature = "block2", feature = "objc2-cloud-kit"))]
172 #[deprecated = "Use -[UIActivityViewController initWithActivityItemsConfiguration:] and pass it a UIActivityItemsConfigurationReading-conforming object with an NSItemProvider and registered preparation handler"]
178 #[unsafe(method(initWithPreparationHandler:))]
179 #[unsafe(method_family = init)]
180 pub unsafe fn initWithPreparationHandler(
181 this: Allocated<Self>,
182 preparation_handler: &block2::DynBlock<
183 dyn Fn(
184 NonNull<UICloudSharingController>,
185 NonNull<block2::DynBlock<dyn Fn(*mut CKShare, *mut CKContainer, *mut NSError)>>,
186 ),
187 >,
188 ) -> Retained<Self>;
189
190 #[cfg(feature = "objc2-cloud-kit")]
191 #[unsafe(method(initWithShare:container:))]
192 #[unsafe(method_family = init)]
193 pub fn initWithShare_container(
194 this: Allocated<Self>,
195 share: &CKShare,
196 container: &CKContainer,
197 ) -> Retained<Self>;
198
199 #[unsafe(method(delegate))]
200 #[unsafe(method_family = none)]
201 pub fn delegate(
202 &self,
203 ) -> Option<Retained<ProtocolObject<dyn UICloudSharingControllerDelegate>>>;
204
205 #[unsafe(method(setDelegate:))]
209 #[unsafe(method_family = none)]
210 pub fn setDelegate(
211 &self,
212 delegate: Option<&ProtocolObject<dyn UICloudSharingControllerDelegate>>,
213 );
214
215 #[cfg(feature = "objc2-cloud-kit")]
216 #[unsafe(method(share))]
217 #[unsafe(method_family = none)]
218 pub fn share(&self) -> Option<Retained<CKShare>>;
219
220 #[unsafe(method(availablePermissions))]
221 #[unsafe(method_family = none)]
222 pub fn availablePermissions(&self) -> UICloudSharingPermissionOptions;
223
224 #[unsafe(method(setAvailablePermissions:))]
226 #[unsafe(method_family = none)]
227 pub fn setAvailablePermissions(
228 &self,
229 available_permissions: UICloudSharingPermissionOptions,
230 );
231
232 #[cfg(feature = "UIActivityItemProvider")]
233 #[unsafe(method(activityItemSource))]
234 #[unsafe(method_family = none)]
235 pub fn activityItemSource(&self) -> Retained<ProtocolObject<dyn UIActivityItemSource>>;
236 );
237}
238
239#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
241impl UICloudSharingController {
242 extern_methods!(
243 #[unsafe(method(init))]
244 #[unsafe(method_family = init)]
245 pub fn init(this: Allocated<Self>) -> Retained<Self>;
246
247 #[unsafe(method(new))]
248 #[unsafe(method_family = new)]
249 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
250 );
251}