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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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"))]
104unsafe impl NSCoding for UICloudSharingController {}
105
106#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
107unsafe impl NSObjectProtocol for UICloudSharingController {}
108
109#[cfg(all(
110 feature = "UIAppearance",
111 feature = "UIResponder",
112 feature = "UIViewController"
113))]
114unsafe impl UIAppearanceContainer for UICloudSharingController {}
115
116#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
117unsafe impl UIContentContainer for UICloudSharingController {}
118
119#[cfg(all(
120 feature = "UIFocus",
121 feature = "UIResponder",
122 feature = "UIViewController"
123))]
124unsafe impl UIFocusEnvironment for UICloudSharingController {}
125
126#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
127unsafe impl UIResponderStandardEditActions for UICloudSharingController {}
128
129#[cfg(all(
130 feature = "UIResponder",
131 feature = "UITraitCollection",
132 feature = "UIViewController"
133))]
134unsafe impl UITraitEnvironment for UICloudSharingController {}
135
136#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
137impl UICloudSharingController {
138 extern_methods!(
139 #[unsafe(method(initWithNibName:bundle:))]
140 #[unsafe(method_family = init)]
141 pub unsafe fn initWithNibName_bundle(
142 this: Allocated<Self>,
143 nib_name_or_nil: Option<&NSString>,
144 nib_bundle_or_nil: Option<&NSBundle>,
145 ) -> Retained<Self>;
146
147 #[unsafe(method(initWithCoder:))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn initWithCoder(
150 this: Allocated<Self>,
151 coder: &NSCoder,
152 ) -> Option<Retained<Self>>;
153
154 #[cfg(all(feature = "block2", feature = "objc2-cloud-kit"))]
155 #[deprecated = "Use -[UIActivityViewController initWithActivityItemsConfiguration:] and pass it a UIActivityItemsConfigurationReading-conforming object with an NSItemProvider and registered preparation handler"]
156 #[unsafe(method(initWithPreparationHandler:))]
157 #[unsafe(method_family = init)]
158 pub unsafe fn initWithPreparationHandler(
159 this: Allocated<Self>,
160 preparation_handler: &block2::Block<
161 dyn Fn(
162 NonNull<UICloudSharingController>,
163 NonNull<block2::Block<dyn Fn(*mut CKShare, *mut CKContainer, *mut NSError)>>,
164 ),
165 >,
166 ) -> Retained<Self>;
167
168 #[cfg(feature = "objc2-cloud-kit")]
169 #[unsafe(method(initWithShare:container:))]
170 #[unsafe(method_family = init)]
171 pub unsafe fn initWithShare_container(
172 this: Allocated<Self>,
173 share: &CKShare,
174 container: &CKContainer,
175 ) -> Retained<Self>;
176
177 #[unsafe(method(delegate))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn delegate(
180 &self,
181 ) -> Option<Retained<ProtocolObject<dyn UICloudSharingControllerDelegate>>>;
182
183 #[unsafe(method(setDelegate:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn setDelegate(
188 &self,
189 delegate: Option<&ProtocolObject<dyn UICloudSharingControllerDelegate>>,
190 );
191
192 #[cfg(feature = "objc2-cloud-kit")]
193 #[unsafe(method(share))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn share(&self) -> Option<Retained<CKShare>>;
196
197 #[unsafe(method(availablePermissions))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn availablePermissions(&self) -> UICloudSharingPermissionOptions;
200
201 #[unsafe(method(setAvailablePermissions:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn setAvailablePermissions(
205 &self,
206 available_permissions: UICloudSharingPermissionOptions,
207 );
208
209 #[cfg(feature = "UIActivityItemProvider")]
210 #[unsafe(method(activityItemSource))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn activityItemSource(
213 &self,
214 ) -> Retained<ProtocolObject<dyn UIActivityItemSource>>;
215 );
216}
217
218#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
220impl UICloudSharingController {
221 extern_methods!(
222 #[unsafe(method(init))]
223 #[unsafe(method_family = init)]
224 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226 #[unsafe(method(new))]
227 #[unsafe(method_family = new)]
228 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
229 );
230}