objc2_photos/generated/
PHCollection.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-location")]
6use objc2_core_location::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12 #[unsafe(super(PHObject, NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[cfg(feature = "PHObject")]
16 pub struct PHCollection;
17);
18
19#[cfg(feature = "PHObject")]
20unsafe impl Send for PHCollection {}
21
22#[cfg(feature = "PHObject")]
23unsafe impl Sync for PHCollection {}
24
25#[cfg(feature = "PHObject")]
26extern_conformance!(
27 unsafe impl NSCopying for PHCollection {}
28);
29
30#[cfg(feature = "PHObject")]
31unsafe impl CopyingHelper for PHCollection {
32 type Result = Self;
33}
34
35#[cfg(feature = "PHObject")]
36extern_conformance!(
37 unsafe impl NSObjectProtocol for PHCollection {}
38);
39
40#[cfg(feature = "PHObject")]
41impl PHCollection {
42 extern_methods!(
43 #[unsafe(method(canContainAssets))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn canContainAssets(&self) -> bool;
51
52 #[unsafe(method(canContainCollections))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn canContainCollections(&self) -> bool;
60
61 #[unsafe(method(localizedTitle))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn localizedTitle(&self) -> Option<Retained<NSString>>;
69
70 #[cfg(feature = "PhotosTypes")]
71 #[unsafe(method(canPerformEditOperation:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn canPerformEditOperation(
74 &self,
75 an_operation: PHCollectionEditOperation,
76 ) -> bool;
77
78 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
79 #[unsafe(method(fetchCollectionsInCollectionList:options:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn fetchCollectionsInCollectionList_options(
82 collection_list: &PHCollectionList,
83 options: Option<&PHFetchOptions>,
84 ) -> Retained<PHFetchResult<PHCollection>>;
85
86 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
87 #[unsafe(method(fetchTopLevelUserCollectionsWithOptions:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn fetchTopLevelUserCollectionsWithOptions(
90 options: Option<&PHFetchOptions>,
91 ) -> Retained<PHFetchResult<PHCollection>>;
92 );
93}
94
95#[cfg(feature = "PHObject")]
97impl PHCollection {
98 extern_methods!(
99 #[unsafe(method(init))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
102
103 #[unsafe(method(new))]
104 #[unsafe(method_family = new)]
105 pub unsafe fn new() -> Retained<Self>;
106 );
107}
108
109extern_class!(
110 #[unsafe(super(PHCollection, PHObject, NSObject))]
112 #[derive(Debug, PartialEq, Eq, Hash)]
113 #[cfg(feature = "PHObject")]
114 pub struct PHAssetCollection;
115);
116
117#[cfg(feature = "PHObject")]
118unsafe impl Send for PHAssetCollection {}
119
120#[cfg(feature = "PHObject")]
121unsafe impl Sync for PHAssetCollection {}
122
123#[cfg(feature = "PHObject")]
124extern_conformance!(
125 unsafe impl NSCopying for PHAssetCollection {}
126);
127
128#[cfg(feature = "PHObject")]
129unsafe impl CopyingHelper for PHAssetCollection {
130 type Result = Self;
131}
132
133#[cfg(feature = "PHObject")]
134extern_conformance!(
135 unsafe impl NSObjectProtocol for PHAssetCollection {}
136);
137
138#[cfg(feature = "PHObject")]
139impl PHAssetCollection {
140 extern_methods!(
141 #[cfg(feature = "PhotosTypes")]
142 #[unsafe(method(assetCollectionType))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn assetCollectionType(&self) -> PHAssetCollectionType;
150
151 #[cfg(feature = "PhotosTypes")]
152 #[unsafe(method(assetCollectionSubtype))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn assetCollectionSubtype(&self) -> PHAssetCollectionSubtype;
160
161 #[unsafe(method(estimatedAssetCount))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn estimatedAssetCount(&self) -> NSUInteger;
169
170 #[unsafe(method(startDate))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn startDate(&self) -> Option<Retained<NSDate>>;
178
179 #[unsafe(method(endDate))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn endDate(&self) -> Option<Retained<NSDate>>;
187
188 #[cfg(feature = "objc2-core-location")]
189 #[unsafe(method(approximateLocation))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn approximateLocation(&self) -> Option<Retained<CLLocation>>;
197
198 #[unsafe(method(localizedLocationNames))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn localizedLocationNames(&self) -> Retained<NSArray<NSString>>;
206
207 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
208 #[unsafe(method(fetchAssetCollectionsWithLocalIdentifiers:options:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn fetchAssetCollectionsWithLocalIdentifiers_options(
211 identifiers: &NSArray<NSString>,
212 options: Option<&PHFetchOptions>,
213 ) -> Retained<PHFetchResult<PHAssetCollection>>;
214
215 #[cfg(all(
216 feature = "PHFetchOptions",
217 feature = "PHFetchResult",
218 feature = "PhotosTypes"
219 ))]
220 #[unsafe(method(fetchAssetCollectionsWithType:subtype:options:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn fetchAssetCollectionsWithType_subtype_options(
223 r#type: PHAssetCollectionType,
224 subtype: PHAssetCollectionSubtype,
225 options: Option<&PHFetchOptions>,
226 ) -> Retained<PHFetchResult<PHAssetCollection>>;
227
228 #[cfg(all(
229 feature = "PHAsset",
230 feature = "PHFetchOptions",
231 feature = "PHFetchResult",
232 feature = "PhotosTypes"
233 ))]
234 #[unsafe(method(fetchAssetCollectionsContainingAsset:withType:options:))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn fetchAssetCollectionsContainingAsset_withType_options(
237 asset: &PHAsset,
238 r#type: PHAssetCollectionType,
239 options: Option<&PHFetchOptions>,
240 ) -> Retained<PHFetchResult<PHAssetCollection>>;
241
242 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
243 #[deprecated = "Will be removed in a future release"]
244 #[unsafe(method(fetchAssetCollectionsWithALAssetGroupURLs:options:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn fetchAssetCollectionsWithALAssetGroupURLs_options(
247 asset_group_ur_ls: &NSArray<NSURL>,
248 options: Option<&PHFetchOptions>,
249 ) -> Retained<PHFetchResult<PHAssetCollection>>;
250
251 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
252 #[deprecated = "Will be removed in a future release"]
253 #[unsafe(method(fetchMomentsInMomentList:options:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn fetchMomentsInMomentList_options(
256 moment_list: &PHCollectionList,
257 options: Option<&PHFetchOptions>,
258 ) -> Retained<PHFetchResult<PHAssetCollection>>;
259
260 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
261 #[deprecated = "Will be removed in a future release"]
262 #[unsafe(method(fetchMomentsWithOptions:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn fetchMomentsWithOptions(
265 options: Option<&PHFetchOptions>,
266 ) -> Retained<PHFetchResult<PHAssetCollection>>;
267
268 #[cfg(feature = "PHAsset")]
269 #[unsafe(method(transientAssetCollectionWithAssets:title:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn transientAssetCollectionWithAssets_title(
272 assets: &NSArray<PHAsset>,
273 title: Option<&NSString>,
274 ) -> Retained<PHAssetCollection>;
275
276 #[cfg(all(feature = "PHAsset", feature = "PHFetchResult"))]
277 #[unsafe(method(transientAssetCollectionWithAssetFetchResult:title:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn transientAssetCollectionWithAssetFetchResult_title(
280 fetch_result: &PHFetchResult<PHAsset>,
281 title: Option<&NSString>,
282 ) -> Retained<PHAssetCollection>;
283 );
284}
285
286#[cfg(feature = "PHObject")]
288impl PHAssetCollection {
289 extern_methods!(
290 #[unsafe(method(init))]
291 #[unsafe(method_family = init)]
292 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
293
294 #[unsafe(method(new))]
295 #[unsafe(method_family = new)]
296 pub unsafe fn new() -> Retained<Self>;
297 );
298}
299
300extern_class!(
301 #[unsafe(super(PHCollection, PHObject, NSObject))]
303 #[derive(Debug, PartialEq, Eq, Hash)]
304 #[cfg(feature = "PHObject")]
305 pub struct PHCollectionList;
306);
307
308#[cfg(feature = "PHObject")]
309unsafe impl Send for PHCollectionList {}
310
311#[cfg(feature = "PHObject")]
312unsafe impl Sync for PHCollectionList {}
313
314#[cfg(feature = "PHObject")]
315extern_conformance!(
316 unsafe impl NSCopying for PHCollectionList {}
317);
318
319#[cfg(feature = "PHObject")]
320unsafe impl CopyingHelper for PHCollectionList {
321 type Result = Self;
322}
323
324#[cfg(feature = "PHObject")]
325extern_conformance!(
326 unsafe impl NSObjectProtocol for PHCollectionList {}
327);
328
329#[cfg(feature = "PHObject")]
330impl PHCollectionList {
331 extern_methods!(
332 #[cfg(feature = "PhotosTypes")]
333 #[unsafe(method(collectionListType))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn collectionListType(&self) -> PHCollectionListType;
341
342 #[cfg(feature = "PhotosTypes")]
343 #[unsafe(method(collectionListSubtype))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn collectionListSubtype(&self) -> PHCollectionListSubtype;
351
352 #[unsafe(method(startDate))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn startDate(&self) -> Option<Retained<NSDate>>;
360
361 #[unsafe(method(endDate))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn endDate(&self) -> Option<Retained<NSDate>>;
369
370 #[unsafe(method(localizedLocationNames))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn localizedLocationNames(&self) -> Retained<NSArray<NSString>>;
378
379 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
380 #[unsafe(method(fetchCollectionListsContainingCollection:options:))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn fetchCollectionListsContainingCollection_options(
383 collection: &PHCollection,
384 options: Option<&PHFetchOptions>,
385 ) -> Retained<PHFetchResult<PHCollectionList>>;
386
387 #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
388 #[unsafe(method(fetchCollectionListsWithLocalIdentifiers:options:))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn fetchCollectionListsWithLocalIdentifiers_options(
391 identifiers: &NSArray<NSString>,
392 options: Option<&PHFetchOptions>,
393 ) -> Retained<PHFetchResult<PHCollectionList>>;
394
395 #[cfg(all(
396 feature = "PHFetchOptions",
397 feature = "PHFetchResult",
398 feature = "PhotosTypes"
399 ))]
400 #[unsafe(method(fetchCollectionListsWithType:subtype:options:))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn fetchCollectionListsWithType_subtype_options(
403 collection_list_type: PHCollectionListType,
404 subtype: PHCollectionListSubtype,
405 options: Option<&PHFetchOptions>,
406 ) -> Retained<PHFetchResult<PHCollectionList>>;
407
408 #[cfg(all(
409 feature = "PHFetchOptions",
410 feature = "PHFetchResult",
411 feature = "PhotosTypes"
412 ))]
413 #[deprecated = "Will be removed in a future release"]
414 #[unsafe(method(fetchMomentListsWithSubtype:containingMoment:options:))]
415 #[unsafe(method_family = none)]
416 pub unsafe fn fetchMomentListsWithSubtype_containingMoment_options(
417 moment_list_subtype: PHCollectionListSubtype,
418 moment: &PHAssetCollection,
419 options: Option<&PHFetchOptions>,
420 ) -> Retained<PHFetchResult<PHCollectionList>>;
421
422 #[cfg(all(
423 feature = "PHFetchOptions",
424 feature = "PHFetchResult",
425 feature = "PhotosTypes"
426 ))]
427 #[deprecated = "Will be removed in a future release"]
428 #[unsafe(method(fetchMomentListsWithSubtype:options:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn fetchMomentListsWithSubtype_options(
431 moment_list_subtype: PHCollectionListSubtype,
432 options: Option<&PHFetchOptions>,
433 ) -> Retained<PHFetchResult<PHCollectionList>>;
434
435 #[unsafe(method(transientCollectionListWithCollections:title:))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn transientCollectionListWithCollections_title(
438 collections: &NSArray<PHCollection>,
439 title: Option<&NSString>,
440 ) -> Retained<PHCollectionList>;
441
442 #[cfg(feature = "PHFetchResult")]
443 #[unsafe(method(transientCollectionListWithCollectionsFetchResult:title:))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn transientCollectionListWithCollectionsFetchResult_title(
446 fetch_result: &PHFetchResult<PHCollection>,
447 title: Option<&NSString>,
448 ) -> Retained<PHCollectionList>;
449 );
450}
451
452#[cfg(feature = "PHObject")]
454impl PHCollectionList {
455 extern_methods!(
456 #[unsafe(method(init))]
457 #[unsafe(method_family = init)]
458 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
459
460 #[unsafe(method(new))]
461 #[unsafe(method_family = new)]
462 pub unsafe fn new() -> Retained<Self>;
463 );
464}