1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-cloud-kit")]
use objc2_cloud_kit::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICloudSharingPermissionOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UICloudSharingPermissionOptions: NSUInteger {
        const UICloudSharingPermissionStandard = 0;
        const UICloudSharingPermissionAllowPublic = 1<<0;
        const UICloudSharingPermissionAllowPrivate = 1<<1;
        const UICloudSharingPermissionAllowReadOnly = 1<<2;
        const UICloudSharingPermissionAllowReadWrite = 1<<3;
    }
}

unsafe impl Encode for UICloudSharingPermissionOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UICloudSharingPermissionOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    pub unsafe trait UICloudSharingControllerDelegate:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method(cloudSharingController:failedToSaveShareWithError:)]
        unsafe fn cloudSharingController_failedToSaveShareWithError(
            &self,
            csc: &UICloudSharingController,
            error: &NSError,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Other itemTitleForCloudSharingController:)]
        unsafe fn itemTitleForCloudSharingController(
            &self,
            csc: &UICloudSharingController,
        ) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method_id(@__retain_semantics Other itemThumbnailDataForCloudSharingController:)]
        unsafe fn itemThumbnailDataForCloudSharingController(
            &self,
            csc: &UICloudSharingController,
        ) -> Option<Retained<NSData>>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method_id(@__retain_semantics Other itemTypeForCloudSharingController:)]
        unsafe fn itemTypeForCloudSharingController(
            &self,
            csc: &UICloudSharingController,
        ) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(cloudSharingControllerDidSaveShare:)]
        unsafe fn cloudSharingControllerDidSaveShare(&self, csc: &UICloudSharingController);

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(cloudSharingControllerDidStopSharing:)]
        unsafe fn cloudSharingControllerDidStopSharing(&self, csc: &UICloudSharingController);
    }

    unsafe impl ProtocolType for dyn UICloudSharingControllerDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UICloudSharingController;

    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl ClassType for UICloudSharingController {
        #[inherits(UIResponder, NSObject)]
        type Super = UIViewController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSCoding for UICloudSharingController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSObjectProtocol for UICloudSharingController {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIAppearanceContainer for UICloudSharingController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl UIContentContainer for UICloudSharingController {}

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIFocusEnvironment for UICloudSharingController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl UIResponderStandardEditActions for UICloudSharingController {}

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
unsafe impl UITraitEnvironment for UICloudSharingController {}

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UICloudSharingController {
        #[method_id(@__retain_semantics Init initWithNibName:bundle:)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "block2", feature = "objc2-cloud-kit"))]
        #[deprecated = "Use -[UIActivityViewController initWithActivityItemsConfiguration:] and pass it a UIActivityItemsConfigurationReading-conforming object with an NSItemProvider and registered preparation handler"]
        #[method_id(@__retain_semantics Init initWithPreparationHandler:)]
        pub unsafe fn initWithPreparationHandler(
            this: Allocated<Self>,
            preparation_handler: &block2::Block<
                dyn Fn(
                    NonNull<UICloudSharingController>,
                    NonNull<block2::Block<dyn Fn(*mut CKShare, *mut CKContainer, *mut NSError)>>,
                ),
            >,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-cloud-kit")]
        #[method_id(@__retain_semantics Init initWithShare:container:)]
        pub unsafe fn initWithShare_container(
            this: Allocated<Self>,
            share: &CKShare,
            container: &CKContainer,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UICloudSharingControllerDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UICloudSharingControllerDelegate>>,
        );

        #[cfg(feature = "objc2-cloud-kit")]
        #[method_id(@__retain_semantics Other share)]
        pub unsafe fn share(&self) -> Option<Retained<CKShare>>;

        #[method(availablePermissions)]
        pub unsafe fn availablePermissions(&self) -> UICloudSharingPermissionOptions;

        #[method(setAvailablePermissions:)]
        pub unsafe fn setAvailablePermissions(
            &self,
            available_permissions: UICloudSharingPermissionOptions,
        );

        #[cfg(feature = "UIActivityItemProvider")]
        #[method_id(@__retain_semantics Other activityItemSource)]
        pub unsafe fn activityItemSource(
            &self,
        ) -> Retained<ProtocolObject<dyn UIActivityItemSource>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UICloudSharingController {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);