Skip to main content

objc2_photos/generated/
PHImageManager.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#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-av-foundation")]
10use objc2_av_foundation::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13use objc2_foundation::*;
14#[cfg(feature = "objc2-image-io")]
15use objc2_image_io::*;
16
17use crate::*;
18
19/// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagerequestoptionsversion?language=objc)
20// NS_ENUM
21#[repr(transparent)]
22#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
23pub struct PHImageRequestOptionsVersion(pub NSInteger);
24impl PHImageRequestOptionsVersion {
25    #[doc(alias = "PHImageRequestOptionsVersionCurrent")]
26    pub const Current: Self = Self(0);
27    #[doc(alias = "PHImageRequestOptionsVersionUnadjusted")]
28    pub const Unadjusted: Self = Self(1);
29    #[doc(alias = "PHImageRequestOptionsVersionOriginal")]
30    pub const Original: Self = Self(2);
31}
32
33unsafe impl Encode for PHImageRequestOptionsVersion {
34    const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for PHImageRequestOptionsVersion {
38    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41/// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagerequestoptionsdeliverymode?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct PHImageRequestOptionsDeliveryMode(pub NSInteger);
46impl PHImageRequestOptionsDeliveryMode {
47    #[doc(alias = "PHImageRequestOptionsDeliveryModeOpportunistic")]
48    pub const Opportunistic: Self = Self(0);
49    #[doc(alias = "PHImageRequestOptionsDeliveryModeHighQualityFormat")]
50    pub const HighQualityFormat: Self = Self(1);
51    #[doc(alias = "PHImageRequestOptionsDeliveryModeFastFormat")]
52    pub const FastFormat: Self = Self(2);
53}
54
55unsafe impl Encode for PHImageRequestOptionsDeliveryMode {
56    const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for PHImageRequestOptionsDeliveryMode {
60    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63/// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagerequestoptionsresizemode?language=objc)
64// NS_ENUM
65#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct PHImageRequestOptionsResizeMode(pub NSInteger);
68impl PHImageRequestOptionsResizeMode {
69    #[doc(alias = "PHImageRequestOptionsResizeModeNone")]
70    pub const None: Self = Self(0);
71    #[doc(alias = "PHImageRequestOptionsResizeModeFast")]
72    pub const Fast: Self = Self(1);
73    #[doc(alias = "PHImageRequestOptionsResizeModeExact")]
74    pub const Exact: Self = Self(2);
75}
76
77unsafe impl Encode for PHImageRequestOptionsResizeMode {
78    const ENCODING: Encoding = NSInteger::ENCODING;
79}
80
81unsafe impl RefEncode for PHImageRequestOptionsResizeMode {
82    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
83}
84
85/// [Apple's documentation](https://developer.apple.com/documentation/photos/phassetimageprogresshandler?language=objc)
86#[cfg(feature = "block2")]
87pub type PHAssetImageProgressHandler =
88    *mut block2::DynBlock<dyn Fn(c_double, *mut NSError, NonNull<Bool>, *mut NSDictionary)>;
89
90extern_class!(
91    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagerequestoptions?language=objc)
92    #[unsafe(super(NSObject))]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    pub struct PHImageRequestOptions;
95);
96
97extern_conformance!(
98    unsafe impl NSCopying for PHImageRequestOptions {}
99);
100
101unsafe impl CopyingHelper for PHImageRequestOptions {
102    type Result = Self;
103}
104
105extern_conformance!(
106    unsafe impl NSObjectProtocol for PHImageRequestOptions {}
107);
108
109impl PHImageRequestOptions {
110    extern_methods!(
111        #[unsafe(method(version))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn version(&self) -> PHImageRequestOptionsVersion;
114
115        /// Setter for [`version`][Self::version].
116        #[unsafe(method(setVersion:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setVersion(&self, version: PHImageRequestOptionsVersion);
119
120        #[unsafe(method(deliveryMode))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn deliveryMode(&self) -> PHImageRequestOptionsDeliveryMode;
123
124        /// Setter for [`deliveryMode`][Self::deliveryMode].
125        #[unsafe(method(setDeliveryMode:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setDeliveryMode(&self, delivery_mode: PHImageRequestOptionsDeliveryMode);
128
129        #[unsafe(method(resizeMode))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn resizeMode(&self) -> PHImageRequestOptionsResizeMode;
132
133        /// Setter for [`resizeMode`][Self::resizeMode].
134        #[unsafe(method(setResizeMode:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setResizeMode(&self, resize_mode: PHImageRequestOptionsResizeMode);
137
138        #[cfg(feature = "objc2-core-foundation")]
139        #[unsafe(method(normalizedCropRect))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn normalizedCropRect(&self) -> CGRect;
142
143        #[cfg(feature = "objc2-core-foundation")]
144        /// Setter for [`normalizedCropRect`][Self::normalizedCropRect].
145        #[unsafe(method(setNormalizedCropRect:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setNormalizedCropRect(&self, normalized_crop_rect: CGRect);
148
149        #[unsafe(method(isNetworkAccessAllowed))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn isNetworkAccessAllowed(&self) -> bool;
152
153        /// Setter for [`isNetworkAccessAllowed`][Self::isNetworkAccessAllowed].
154        #[unsafe(method(setNetworkAccessAllowed:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setNetworkAccessAllowed(&self, network_access_allowed: bool);
157
158        #[unsafe(method(isSynchronous))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn isSynchronous(&self) -> bool;
161
162        /// Setter for [`isSynchronous`][Self::isSynchronous].
163        #[unsafe(method(setSynchronous:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setSynchronous(&self, synchronous: bool);
166
167        #[cfg(feature = "block2")]
168        /// # Safety
169        ///
170        /// - The returned block's argument 2 must be a valid pointer or null.
171        /// - The returned block's argument 3 must be a valid pointer.
172        /// - The returned block's argument 4 must be a valid pointer or null.
173        #[unsafe(method(progressHandler))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn progressHandler(&self) -> PHAssetImageProgressHandler;
176
177        #[cfg(feature = "block2")]
178        /// Setter for [`progressHandler`][Self::progressHandler].
179        ///
180        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
181        ///
182        /// # Safety
183        ///
184        /// `progress_handler` must be a valid pointer or null.
185        #[unsafe(method(setProgressHandler:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setProgressHandler(&self, progress_handler: PHAssetImageProgressHandler);
188
189        #[unsafe(method(allowSecondaryDegradedImage))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn allowSecondaryDegradedImage(&self) -> bool;
192
193        /// Setter for [`allowSecondaryDegradedImage`][Self::allowSecondaryDegradedImage].
194        #[unsafe(method(setAllowSecondaryDegradedImage:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setAllowSecondaryDegradedImage(&self, allow_secondary_degraded_image: bool);
197    );
198}
199
200/// Methods declared on superclass `NSObject`.
201impl PHImageRequestOptions {
202    extern_methods!(
203        #[unsafe(method(init))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
206
207        #[unsafe(method(new))]
208        #[unsafe(method_family = new)]
209        pub unsafe fn new() -> Retained<Self>;
210    );
211}
212
213extern_class!(
214    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotorequestoptions?language=objc)
215    #[unsafe(super(NSObject))]
216    #[derive(Debug, PartialEq, Eq, Hash)]
217    pub struct PHLivePhotoRequestOptions;
218);
219
220extern_conformance!(
221    unsafe impl NSCopying for PHLivePhotoRequestOptions {}
222);
223
224unsafe impl CopyingHelper for PHLivePhotoRequestOptions {
225    type Result = Self;
226}
227
228extern_conformance!(
229    unsafe impl NSObjectProtocol for PHLivePhotoRequestOptions {}
230);
231
232impl PHLivePhotoRequestOptions {
233    extern_methods!(
234        #[unsafe(method(version))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn version(&self) -> PHImageRequestOptionsVersion;
237
238        /// Setter for [`version`][Self::version].
239        #[unsafe(method(setVersion:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn setVersion(&self, version: PHImageRequestOptionsVersion);
242
243        #[unsafe(method(deliveryMode))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn deliveryMode(&self) -> PHImageRequestOptionsDeliveryMode;
246
247        /// Setter for [`deliveryMode`][Self::deliveryMode].
248        #[unsafe(method(setDeliveryMode:))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn setDeliveryMode(&self, delivery_mode: PHImageRequestOptionsDeliveryMode);
251
252        #[unsafe(method(isNetworkAccessAllowed))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn isNetworkAccessAllowed(&self) -> bool;
255
256        /// Setter for [`isNetworkAccessAllowed`][Self::isNetworkAccessAllowed].
257        #[unsafe(method(setNetworkAccessAllowed:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setNetworkAccessAllowed(&self, network_access_allowed: bool);
260
261        #[cfg(feature = "block2")]
262        /// # Safety
263        ///
264        /// - The returned block's argument 2 must be a valid pointer or null.
265        /// - The returned block's argument 3 must be a valid pointer.
266        /// - The returned block's argument 4 must be a valid pointer or null.
267        #[unsafe(method(progressHandler))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn progressHandler(&self) -> PHAssetImageProgressHandler;
270
271        #[cfg(feature = "block2")]
272        /// Setter for [`progressHandler`][Self::progressHandler].
273        ///
274        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
275        ///
276        /// # Safety
277        ///
278        /// `progress_handler` must be a valid pointer or null.
279        #[unsafe(method(setProgressHandler:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn setProgressHandler(&self, progress_handler: PHAssetImageProgressHandler);
282    );
283}
284
285/// Methods declared on superclass `NSObject`.
286impl PHLivePhotoRequestOptions {
287    extern_methods!(
288        #[unsafe(method(init))]
289        #[unsafe(method_family = init)]
290        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
291
292        #[unsafe(method(new))]
293        #[unsafe(method_family = new)]
294        pub unsafe fn new() -> Retained<Self>;
295    );
296}
297
298/// [Apple's documentation](https://developer.apple.com/documentation/photos/phvideorequestoptionsversion?language=objc)
299// NS_ENUM
300#[repr(transparent)]
301#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
302pub struct PHVideoRequestOptionsVersion(pub NSInteger);
303impl PHVideoRequestOptionsVersion {
304    #[doc(alias = "PHVideoRequestOptionsVersionCurrent")]
305    pub const Current: Self = Self(0);
306    #[doc(alias = "PHVideoRequestOptionsVersionOriginal")]
307    pub const Original: Self = Self(1);
308}
309
310unsafe impl Encode for PHVideoRequestOptionsVersion {
311    const ENCODING: Encoding = NSInteger::ENCODING;
312}
313
314unsafe impl RefEncode for PHVideoRequestOptionsVersion {
315    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
316}
317
318/// [Apple's documentation](https://developer.apple.com/documentation/photos/phvideorequestoptionsdeliverymode?language=objc)
319// NS_ENUM
320#[repr(transparent)]
321#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
322pub struct PHVideoRequestOptionsDeliveryMode(pub NSInteger);
323impl PHVideoRequestOptionsDeliveryMode {
324    #[doc(alias = "PHVideoRequestOptionsDeliveryModeAutomatic")]
325    pub const Automatic: Self = Self(0);
326    #[doc(alias = "PHVideoRequestOptionsDeliveryModeHighQualityFormat")]
327    pub const HighQualityFormat: Self = Self(1);
328    #[doc(alias = "PHVideoRequestOptionsDeliveryModeMediumQualityFormat")]
329    pub const MediumQualityFormat: Self = Self(2);
330    #[doc(alias = "PHVideoRequestOptionsDeliveryModeFastFormat")]
331    pub const FastFormat: Self = Self(3);
332}
333
334unsafe impl Encode for PHVideoRequestOptionsDeliveryMode {
335    const ENCODING: Encoding = NSInteger::ENCODING;
336}
337
338unsafe impl RefEncode for PHVideoRequestOptionsDeliveryMode {
339    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
340}
341
342/// [Apple's documentation](https://developer.apple.com/documentation/photos/phassetvideoprogresshandler?language=objc)
343#[cfg(feature = "block2")]
344pub type PHAssetVideoProgressHandler =
345    *mut block2::DynBlock<dyn Fn(c_double, *mut NSError, NonNull<Bool>, *mut NSDictionary)>;
346
347extern_class!(
348    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phvideorequestoptions?language=objc)
349    #[unsafe(super(NSObject))]
350    #[derive(Debug, PartialEq, Eq, Hash)]
351    pub struct PHVideoRequestOptions;
352);
353
354extern_conformance!(
355    unsafe impl NSCopying for PHVideoRequestOptions {}
356);
357
358unsafe impl CopyingHelper for PHVideoRequestOptions {
359    type Result = Self;
360}
361
362extern_conformance!(
363    unsafe impl NSObjectProtocol for PHVideoRequestOptions {}
364);
365
366impl PHVideoRequestOptions {
367    extern_methods!(
368        #[unsafe(method(isNetworkAccessAllowed))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn isNetworkAccessAllowed(&self) -> bool;
371
372        /// Setter for [`isNetworkAccessAllowed`][Self::isNetworkAccessAllowed].
373        #[unsafe(method(setNetworkAccessAllowed:))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn setNetworkAccessAllowed(&self, network_access_allowed: bool);
376
377        #[unsafe(method(version))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn version(&self) -> PHVideoRequestOptionsVersion;
380
381        /// Setter for [`version`][Self::version].
382        #[unsafe(method(setVersion:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn setVersion(&self, version: PHVideoRequestOptionsVersion);
385
386        #[unsafe(method(deliveryMode))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn deliveryMode(&self) -> PHVideoRequestOptionsDeliveryMode;
389
390        /// Setter for [`deliveryMode`][Self::deliveryMode].
391        #[unsafe(method(setDeliveryMode:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn setDeliveryMode(&self, delivery_mode: PHVideoRequestOptionsDeliveryMode);
394
395        #[cfg(feature = "block2")]
396        /// # Safety
397        ///
398        /// - The returned block's argument 2 must be a valid pointer or null.
399        /// - The returned block's argument 3 must be a valid pointer.
400        /// - The returned block's argument 4 must be a valid pointer or null.
401        #[unsafe(method(progressHandler))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn progressHandler(&self) -> PHAssetVideoProgressHandler;
404
405        #[cfg(feature = "block2")]
406        /// Setter for [`progressHandler`][Self::progressHandler].
407        ///
408        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
409        ///
410        /// # Safety
411        ///
412        /// `progress_handler` must be a valid pointer or null.
413        #[unsafe(method(setProgressHandler:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn setProgressHandler(&self, progress_handler: PHAssetVideoProgressHandler);
416    );
417}
418
419/// Methods declared on superclass `NSObject`.
420impl PHVideoRequestOptions {
421    extern_methods!(
422        #[unsafe(method(init))]
423        #[unsafe(method_family = init)]
424        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
425
426        #[unsafe(method(new))]
427        #[unsafe(method_family = new)]
428        pub unsafe fn new() -> Retained<Self>;
429    );
430}
431
432/// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagerequestid?language=objc)
433pub type PHImageRequestID = i32;
434
435/// [Apple's documentation](https://developer.apple.com/documentation/photos/phinvalidimagerequestid?language=objc)
436pub static PHInvalidImageRequestID: PHImageRequestID = 0;
437
438extern "C" {
439    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagemanagermaximumsize?language=objc)
440    #[cfg(feature = "objc2-core-foundation")]
441    pub static PHImageManagerMaximumSize: CGSize;
442}
443
444extern "C" {
445    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimageresultisincloudkey?language=objc)
446    pub static PHImageResultIsInCloudKey: &'static NSString;
447}
448
449extern "C" {
450    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimageresultisdegradedkey?language=objc)
451    pub static PHImageResultIsDegradedKey: &'static NSString;
452}
453
454extern "C" {
455    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimageresultrequestidkey?language=objc)
456    pub static PHImageResultRequestIDKey: &'static NSString;
457}
458
459extern "C" {
460    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagecancelledkey?language=objc)
461    pub static PHImageCancelledKey: &'static NSString;
462}
463
464extern "C" {
465    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimageerrorkey?language=objc)
466    pub static PHImageErrorKey: &'static NSString;
467}
468
469extern_class!(
470    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phimagemanager?language=objc)
471    #[unsafe(super(NSObject))]
472    #[derive(Debug, PartialEq, Eq, Hash)]
473    pub struct PHImageManager;
474);
475
476unsafe impl Send for PHImageManager {}
477
478unsafe impl Sync for PHImageManager {}
479
480extern_conformance!(
481    unsafe impl NSObjectProtocol for PHImageManager {}
482);
483
484impl PHImageManager {
485    extern_methods!(
486        #[unsafe(method(defaultManager))]
487        #[unsafe(method_family = none)]
488        pub unsafe fn defaultManager() -> Retained<PHImageManager>;
489
490        #[cfg(all(
491            feature = "PHAsset",
492            feature = "PHObject",
493            feature = "PhotosTypes",
494            feature = "block2",
495            feature = "objc2-app-kit",
496            feature = "objc2-core-foundation"
497        ))]
498        #[cfg(target_os = "macos")]
499        #[unsafe(method(requestImageForAsset:targetSize:contentMode:options:resultHandler:))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn requestImageForAsset_targetSize_contentMode_options_resultHandler(
502            &self,
503            asset: &PHAsset,
504            target_size: CGSize,
505            content_mode: PHImageContentMode,
506            options: Option<&PHImageRequestOptions>,
507            result_handler: &block2::DynBlock<dyn Fn(*mut NSImage, *mut NSDictionary)>,
508        ) -> PHImageRequestID;
509
510        #[cfg(all(
511            feature = "PHAsset",
512            feature = "PHObject",
513            feature = "block2",
514            feature = "objc2-image-io"
515        ))]
516        /// Request largest represented image as data bytes and EXIF orientation for the specified asset.
517        ///
518        /// Parameter `asset`: The asset whose image data is to be loaded.
519        ///
520        /// Parameter `options`: Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors.
521        /// If PHImageRequestOptionsVersionCurrent is requested and the asset has adjustments then the largest rendered image data is returned. In all other cases then the original image data is returned.
522        ///
523        /// Parameter `resultHandler`: A block that is called exactly once either synchronously on the current thread or asynchronously on the main thread depending on the synchronous option specified in the PHImageRequestOptions options parameter (deliveryMode is ignored). Orientation is an EXIF orientation as an CGImagePropertyOrientation. For iOS or tvOS, convert this to an UIImageOrientation.
524        #[unsafe(method(requestImageDataAndOrientationForAsset:options:resultHandler:))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn requestImageDataAndOrientationForAsset_options_resultHandler(
527            &self,
528            asset: &PHAsset,
529            options: Option<&PHImageRequestOptions>,
530            result_handler: &block2::DynBlock<
531                dyn Fn(*mut NSData, *mut NSString, CGImagePropertyOrientation, *mut NSDictionary),
532            >,
533        ) -> PHImageRequestID;
534
535        #[unsafe(method(cancelImageRequest:))]
536        #[unsafe(method_family = none)]
537        pub unsafe fn cancelImageRequest(&self, request_id: PHImageRequestID);
538
539        #[cfg(all(
540            feature = "PHAsset",
541            feature = "PHLivePhoto",
542            feature = "PHObject",
543            feature = "PhotosTypes",
544            feature = "block2",
545            feature = "objc2-core-foundation"
546        ))]
547        /// Requests a live photo representation of the asset. With PHImageRequestOptionsDeliveryModeOpportunistic (or if no options are specified), the resultHandler block may be called more than once (the first call may occur before the method returns). The PHImageResultIsDegradedKey key in the result handler's info parameter indicates when a temporary low-quality live photo is provided.
548        #[unsafe(method(requestLivePhotoForAsset:targetSize:contentMode:options:resultHandler:))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn requestLivePhotoForAsset_targetSize_contentMode_options_resultHandler(
551            &self,
552            asset: &PHAsset,
553            target_size: CGSize,
554            content_mode: PHImageContentMode,
555            options: Option<&PHLivePhotoRequestOptions>,
556            result_handler: &block2::DynBlock<dyn Fn(*mut PHLivePhoto, *mut NSDictionary)>,
557        ) -> PHImageRequestID;
558
559        #[cfg(all(
560            feature = "PHAsset",
561            feature = "PHObject",
562            feature = "block2",
563            feature = "objc2-av-foundation"
564        ))]
565        #[unsafe(method(requestPlayerItemForVideo:options:resultHandler:))]
566        #[unsafe(method_family = none)]
567        pub unsafe fn requestPlayerItemForVideo_options_resultHandler(
568            &self,
569            asset: &PHAsset,
570            options: Option<&PHVideoRequestOptions>,
571            result_handler: &block2::DynBlock<dyn Fn(*mut AVPlayerItem, *mut NSDictionary)>,
572        ) -> PHImageRequestID;
573
574        #[cfg(all(
575            feature = "PHAsset",
576            feature = "PHObject",
577            feature = "block2",
578            feature = "objc2-av-foundation"
579        ))]
580        #[unsafe(method(requestExportSessionForVideo:options:exportPreset:resultHandler:))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn requestExportSessionForVideo_options_exportPreset_resultHandler(
583            &self,
584            asset: &PHAsset,
585            options: Option<&PHVideoRequestOptions>,
586            export_preset: &NSString,
587            result_handler: &block2::DynBlock<dyn Fn(*mut AVAssetExportSession, *mut NSDictionary)>,
588        ) -> PHImageRequestID;
589
590        #[cfg(all(
591            feature = "PHAsset",
592            feature = "PHObject",
593            feature = "block2",
594            feature = "objc2-av-foundation"
595        ))]
596        #[unsafe(method(requestAVAssetForVideo:options:resultHandler:))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn requestAVAssetForVideo_options_resultHandler(
599            &self,
600            asset: &PHAsset,
601            options: Option<&PHVideoRequestOptions>,
602            result_handler: &block2::DynBlock<
603                dyn Fn(*mut AVAsset, *mut AVAudioMix, *mut NSDictionary),
604            >,
605        ) -> PHImageRequestID;
606    );
607}
608
609/// Methods declared on superclass `NSObject`.
610impl PHImageManager {
611    extern_methods!(
612        #[unsafe(method(init))]
613        #[unsafe(method_family = init)]
614        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
615
616        #[unsafe(method(new))]
617        #[unsafe(method_family = new)]
618        pub unsafe fn new() -> Retained<Self>;
619    );
620}
621
622extern_class!(
623    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phcachingimagemanager?language=objc)
624    #[unsafe(super(PHImageManager, NSObject))]
625    #[derive(Debug, PartialEq, Eq, Hash)]
626    pub struct PHCachingImageManager;
627);
628
629unsafe impl Send for PHCachingImageManager {}
630
631unsafe impl Sync for PHCachingImageManager {}
632
633extern_conformance!(
634    unsafe impl NSObjectProtocol for PHCachingImageManager {}
635);
636
637impl PHCachingImageManager {
638    extern_methods!(
639        /// This property is not atomic.
640        ///
641        /// # Safety
642        ///
643        /// This might not be thread-safe.
644        #[deprecated = "This property is unused and will be removed in a future release"]
645        #[unsafe(method(allowsCachingHighQualityImages))]
646        #[unsafe(method_family = none)]
647        pub unsafe fn allowsCachingHighQualityImages(&self) -> bool;
648
649        /// Setter for [`allowsCachingHighQualityImages`][Self::allowsCachingHighQualityImages].
650        ///
651        /// # Safety
652        ///
653        /// This might not be thread-safe.
654        #[deprecated = "This property is unused and will be removed in a future release"]
655        #[unsafe(method(setAllowsCachingHighQualityImages:))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn setAllowsCachingHighQualityImages(
658            &self,
659            allows_caching_high_quality_images: bool,
660        );
661
662        #[cfg(all(
663            feature = "PHAsset",
664            feature = "PHObject",
665            feature = "PhotosTypes",
666            feature = "objc2-core-foundation"
667        ))]
668        #[unsafe(method(startCachingImagesForAssets:targetSize:contentMode:options:))]
669        #[unsafe(method_family = none)]
670        pub unsafe fn startCachingImagesForAssets_targetSize_contentMode_options(
671            &self,
672            assets: &NSArray<PHAsset>,
673            target_size: CGSize,
674            content_mode: PHImageContentMode,
675            options: Option<&PHImageRequestOptions>,
676        );
677
678        #[cfg(all(
679            feature = "PHAsset",
680            feature = "PHObject",
681            feature = "PhotosTypes",
682            feature = "objc2-core-foundation"
683        ))]
684        #[unsafe(method(stopCachingImagesForAssets:targetSize:contentMode:options:))]
685        #[unsafe(method_family = none)]
686        pub unsafe fn stopCachingImagesForAssets_targetSize_contentMode_options(
687            &self,
688            assets: &NSArray<PHAsset>,
689            target_size: CGSize,
690            content_mode: PHImageContentMode,
691            options: Option<&PHImageRequestOptions>,
692        );
693
694        #[unsafe(method(stopCachingImagesForAllAssets))]
695        #[unsafe(method_family = none)]
696        pub unsafe fn stopCachingImagesForAllAssets(&self);
697    );
698}
699
700/// Methods declared on superclass `NSObject`.
701impl PHCachingImageManager {
702    extern_methods!(
703        #[unsafe(method(init))]
704        #[unsafe(method_family = init)]
705        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
706
707        #[unsafe(method(new))]
708        #[unsafe(method_family = new)]
709        pub unsafe fn new() -> Retained<Self>;
710    );
711}