-
Notifications
You must be signed in to change notification settings - Fork 0
/
Photos.framework.h
1760 lines (1265 loc) · 76.2 KB
/
Photos.framework.h
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ========== Photos.framework/Headers/PhotosTypes.h
//
// PhotosTypes.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#ifndef Photos_PhotosTypes_h
#define Photos_PhotosTypes_h
#import <Foundation/Foundation.h>
API_AVAILABLE_BEGIN(macos(10.11), ios(8), tvos(10))
#pragma mark - PHCollectionListTypes
typedef NS_ENUM(NSInteger, PHImageContentMode) {
PHImageContentModeAspectFit = 0,
PHImageContentModeAspectFill = 1,
PHImageContentModeDefault = PHImageContentModeAspectFit
};
typedef NS_ENUM(NSInteger, PHCollectionListType) {
PHCollectionListTypeMomentList API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 1,
PHCollectionListTypeFolder = 2,
PHCollectionListTypeSmartFolder = 3,
};
typedef NS_ENUM(NSInteger, PHCollectionListSubtype) {
// PHCollectionListTypeMomentList subtypes
PHCollectionListSubtypeMomentListCluster API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 1,
PHCollectionListSubtypeMomentListYear API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 2,
// PHCollectionListTypeFolder subtypes
PHCollectionListSubtypeRegularFolder = 100,
// PHCollectionListTypeSmartFolder subtypes
PHCollectionListSubtypeSmartFolderEvents = 200,
PHCollectionListSubtypeSmartFolderFaces = 201,
// Used for fetching if you don't care about the exact subtype
PHCollectionListSubtypeAny = NSIntegerMax
};
#pragma mark - PHCollection types
typedef NS_ENUM(NSInteger, PHCollectionEditOperation) {
PHCollectionEditOperationDeleteContent = 1, // Delete things it contains
PHCollectionEditOperationRemoveContent = 2, // Remove things it contains, they're not deleted from the library
PHCollectionEditOperationAddContent = 3, // Add things from other collection
PHCollectionEditOperationCreateContent = 4, // Create new things, or duplicate them from others in the same container
PHCollectionEditOperationRearrangeContent = 5, // Change the order of things
PHCollectionEditOperationDelete = 6, // Deleting of the container, not the content
PHCollectionEditOperationRename = 7, // Renaming of the container, not the content
};
#pragma mark - PHAssetCollection types
typedef NS_ENUM(NSInteger, PHAssetCollectionType) {
PHAssetCollectionTypeAlbum = 1,
PHAssetCollectionTypeSmartAlbum = 2,
PHAssetCollectionTypeMoment API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 3,
};
typedef NS_ENUM(NSInteger, PHAssetCollectionSubtype) {
// PHAssetCollectionTypeAlbum regular subtypes
PHAssetCollectionSubtypeAlbumRegular = 2,
PHAssetCollectionSubtypeAlbumSyncedEvent = 3,
PHAssetCollectionSubtypeAlbumSyncedFaces = 4,
PHAssetCollectionSubtypeAlbumSyncedAlbum = 5,
PHAssetCollectionSubtypeAlbumImported = 6,
// PHAssetCollectionTypeAlbum shared subtypes
PHAssetCollectionSubtypeAlbumMyPhotoStream = 100,
PHAssetCollectionSubtypeAlbumCloudShared = 101,
// PHAssetCollectionTypeSmartAlbum subtypes
PHAssetCollectionSubtypeSmartAlbumGeneric = 200,
PHAssetCollectionSubtypeSmartAlbumPanoramas = 201,
PHAssetCollectionSubtypeSmartAlbumVideos = 202,
PHAssetCollectionSubtypeSmartAlbumFavorites = 203,
PHAssetCollectionSubtypeSmartAlbumTimelapses = 204,
PHAssetCollectionSubtypeSmartAlbumAllHidden = 205,
PHAssetCollectionSubtypeSmartAlbumRecentlyAdded = 206,
PHAssetCollectionSubtypeSmartAlbumBursts = 207,
PHAssetCollectionSubtypeSmartAlbumSlomoVideos = 208,
PHAssetCollectionSubtypeSmartAlbumUserLibrary = 209,
PHAssetCollectionSubtypeSmartAlbumSelfPortraits API_AVAILABLE(ios(9)) = 210,
PHAssetCollectionSubtypeSmartAlbumScreenshots API_AVAILABLE(ios(9)) = 211,
PHAssetCollectionSubtypeSmartAlbumDepthEffect API_AVAILABLE(macos(10.13), ios(10.2), tvos(10.1)) = 212,
PHAssetCollectionSubtypeSmartAlbumLivePhotos API_AVAILABLE(macos(10.13), ios(10.3), tvos(10.2)) = 213,
PHAssetCollectionSubtypeSmartAlbumAnimated API_AVAILABLE(macos(10.15), ios(11), tvos(11)) = 214,
PHAssetCollectionSubtypeSmartAlbumLongExposures API_AVAILABLE(macos(10.15), ios(11), tvos(11)) = 215,
PHAssetCollectionSubtypeSmartAlbumUnableToUpload API_AVAILABLE(macos(10.15), ios(13), tvos(13)) = 216,
// Used for fetching, if you don't care about the exact subtype
PHAssetCollectionSubtypeAny = NSIntegerMax
};
#pragma mark - PHAsset types
typedef NS_ENUM(NSInteger, PHAssetEditOperation) {
PHAssetEditOperationDelete = 1,
PHAssetEditOperationContent = 2,
PHAssetEditOperationProperties = 3,
};
typedef NS_ENUM(NSInteger, PHAssetPlaybackStyle) {
PHAssetPlaybackStyleUnsupported = 0,
PHAssetPlaybackStyleImage = 1,
PHAssetPlaybackStyleImageAnimated = 2,
PHAssetPlaybackStyleLivePhoto = 3,
PHAssetPlaybackStyleVideo = 4,
PHAssetPlaybackStyleVideoLooping = 5,
} API_AVAILABLE(macos(10.13), ios(11), tvos(11)) NS_SWIFT_NAME(PHAsset.PlaybackStyle);
typedef NS_ENUM(NSInteger, PHAssetMediaType) {
PHAssetMediaTypeUnknown = 0,
PHAssetMediaTypeImage = 1,
PHAssetMediaTypeVideo = 2,
PHAssetMediaTypeAudio = 3,
};
typedef NS_OPTIONS(NSUInteger, PHAssetMediaSubtype) {
PHAssetMediaSubtypeNone = 0,
// Photo subtypes
PHAssetMediaSubtypePhotoPanorama = (1UL << 0),
PHAssetMediaSubtypePhotoHDR = (1UL << 1),
PHAssetMediaSubtypePhotoScreenshot API_AVAILABLE(ios(9)) = (1UL << 2),
PHAssetMediaSubtypePhotoLive API_AVAILABLE(ios(9.1)) = (1UL << 3),
PHAssetMediaSubtypePhotoDepthEffect API_AVAILABLE(macos(10.12.2), ios(10.2), tvos(10.1)) = (1UL << 4),
// Video subtypes
PHAssetMediaSubtypeVideoStreamed = (1UL << 16),
PHAssetMediaSubtypeVideoHighFrameRate = (1UL << 17),
PHAssetMediaSubtypeVideoTimelapse = (1UL << 18),
};
typedef NS_OPTIONS(NSUInteger, PHAssetBurstSelectionType) {
PHAssetBurstSelectionTypeNone = 0,
PHAssetBurstSelectionTypeAutoPick = (1UL << 0),
PHAssetBurstSelectionTypeUserPick = (1UL << 1),
};
typedef NS_OPTIONS(NSUInteger, PHAssetSourceType) {
PHAssetSourceTypeNone = 0,
PHAssetSourceTypeUserLibrary = (1UL << 0),
PHAssetSourceTypeCloudShared = (1UL << 1),
PHAssetSourceTypeiTunesSynced = (1UL << 2),
} API_AVAILABLE(ios(9));
typedef NS_ENUM(NSInteger, PHAssetResourceType) {
PHAssetResourceTypePhoto = 1,
PHAssetResourceTypeVideo = 2,
PHAssetResourceTypeAudio = 3,
PHAssetResourceTypeAlternatePhoto = 4,
PHAssetResourceTypeFullSizePhoto = 5,
PHAssetResourceTypeFullSizeVideo = 6,
PHAssetResourceTypeAdjustmentData = 7,
PHAssetResourceTypeAdjustmentBasePhoto = 8,
PHAssetResourceTypePairedVideo API_AVAILABLE(ios(9.1)) = 9,
PHAssetResourceTypeFullSizePairedVideo API_AVAILABLE(macos(10.15), ios(10)) = 10,
PHAssetResourceTypeAdjustmentBasePairedVideo API_AVAILABLE(macos(10.15), ios(10)) = 11,
} API_AVAILABLE(ios(9));
API_AVAILABLE_END
#endif
// ========== Photos.framework/Headers/PHError.h
//
// PHError.h
// Photos
//
// Copyright © 2019 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
API_AVAILABLE_BEGIN(macos(10.15), ios(13), tvos(13))
OS_EXPORT NSErrorDomain const PHPhotosErrorDomain;
NS_ERROR_ENUM(PHPhotosErrorDomain) {
PHPhotosErrorInvalid = -1,
PHPhotosErrorUserCancelled = 3072,
PHPhotosErrorLibraryVolumeOffline = 3114,
PHPhotosErrorRelinquishingLibraryBundleToWriter = 3142,
PHPhotosErrorSwitchingSystemPhotoLibrary = 3143,
};
API_AVAILABLE_END
// ========== Photos.framework/Headers/PHCloudIdentifier.h
//
// PHCloudIdentifier.h
// Photos
//
// Copyright © 2017 Apple, Inc. All rights reserved.
//
#import <Photos/PHPhotoLibrary.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.13))
API_UNAVAILABLE_BEGIN(ios, tvos, uikitformac)
OS_EXPORT
@interface PHCloudIdentifier : NSObject <NSSecureCoding>
/// If there is a failure to determine the global identifier for a local identifier, the notFoundIdentifier is provided in that array slot.
@property (class, nonatomic, readonly) PHCloudIdentifier *notFoundIdentifier;
@property (nonatomic, readonly) NSString *stringValue; /// For use in serialization
- (instancetype)initWithStringValue:(NSString *)stringValue; /// Deserialization
@end
@interface PHPhotoLibrary (CloudIdentifiers)
/// These two methods can be very expensive so they should be used sparingly for batch lookup of all needed identifiers. Clients should work in terms of local identifiers and call these methods only once after loading from and before saving to persistent storage.
- (NSArray<NSString *> *)localIdentifiersForCloudIdentifiers:(NSArray<PHCloudIdentifier *> *)cloudIdentifiers;
- (NSArray<PHCloudIdentifier *> *)cloudIdentifiersForLocalIdentifiers:(NSArray<NSString *> *)localIdentifiers;
@end
/// If the local object cannot be resolved from a global identifier, PHLocalIdentifierNotFound is provided in that array slot.
extern NSString * const PHLocalIdentifierNotFound;
API_UNAVAILABLE_END
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHFetchResult.h
//
// PHFetchResult.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PhotosTypes.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.13), ios(8), tvos(10))
// Accessing fetched results (fetches objects from the backing store in chunks on demand rather than all at once)
// Fetched objects will be kept in a cache and purged under memory pressure
OS_EXPORT
@interface PHFetchResult<__covariant ObjectType> : NSObject <NSCopying, NSFastEnumeration>
@property (readonly) NSUInteger count;
- (ObjectType)objectAtIndex:(NSUInteger)index;
- (ObjectType)objectAtIndexedSubscript:(NSUInteger)idx;
- (BOOL)containsObject:(ObjectType)anObject;
- (NSUInteger)indexOfObject:(ObjectType)anObject;
- (NSUInteger)indexOfObject:(ObjectType)anObject inRange:(NSRange)range;
@property (nonatomic, readonly, nullable) ObjectType firstObject;
@property (nonatomic, readonly, nullable) ObjectType lastObject;
- (NSArray<ObjectType> *)objectsAtIndexes:(NSIndexSet *)indexes;
- (void)enumerateObjectsUsingBlock:(void (^)(ObjectType obj, NSUInteger idx, BOOL *stop))block;
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(ObjectType obj, NSUInteger idx, BOOL *stop))block;
- (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (^)(ObjectType obj, NSUInteger idx, BOOL *stop))block;
- (NSUInteger)countOfAssetsWithMediaType:(PHAssetMediaType)mediaType;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHChange.h
//
// PHChange.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PHFetchResult.h>
@class PHObject;
@class PHObjectChangeDetails;
@class PHFetchResultChangeDetails;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.13), ios(8), tvos(10))
OS_EXPORT
@interface PHChange : NSObject
- (nullable PHObjectChangeDetails *)changeDetailsForObject:(PHObject *)object;
- (nullable PHFetchResultChangeDetails *)changeDetailsForFetchResult:(PHFetchResult *)object;
@end
#pragma mark -
OS_EXPORT
@interface PHObjectChangeDetails<ObjectType: PHObject *> : NSObject
// the object in the state before this change (returns the object that was passed in to changeDetailsForObject:)
@property (atomic, strong, readonly) ObjectType objectBeforeChanges;
// the object in the state after this change
@property (atomic, strong, readonly, nullable) ObjectType objectAfterChanges;
// YES if the image or video content for this object has been changed
@property (atomic, readonly) BOOL assetContentChanged;
// YES if the object was deleted
@property (atomic, readonly) BOOL objectWasDeleted;
@end
#pragma mark -
OS_EXPORT
@interface PHFetchResultChangeDetails<ObjectType: PHObject *> : NSObject
// fetch result with the state of the fetched objects before this change (returns the fetch result passed in to changeDetailsForFetchResult:)
@property (atomic, strong, readonly) PHFetchResult<ObjectType> *fetchResultBeforeChanges;
// fetch result with the state of the fetched objects after this change
@property (atomic, strong, readonly) PHFetchResult<ObjectType> *fetchResultAfterChanges;
// YES if the changes to this fetch result are described by the removed/inserted/changed details.
// NO indicates that the scope of changes were too large and UI clients should do a full reload, incremental changes could not be provided
@property (atomic, assign, readonly) BOOL hasIncrementalChanges;
// The indexes of the removed items, relative to the 'before' state of the fetch result
// returns nil if hasIncrementalChanges is NO
@property (atomic, strong, readonly, nullable) NSIndexSet *removedIndexes;
@property (atomic, strong, readonly) NSArray<ObjectType> *removedObjects;
// The indexes of the inserted items, relative to the 'before' state of the fetch result after applying the removedIndexes
// returns nil if hasIncrementalChanges is NO
@property (atomic, strong, readonly, nullable) NSIndexSet *insertedIndexes;
@property (atomic, strong, readonly) NSArray<ObjectType> *insertedObjects;
// The indexes of the updated items, relative to the 'after' state of the fetch result
// returns nil if hasIncrementalChanges is NO
@property (atomic, strong, readonly, nullable) NSIndexSet *changedIndexes;
@property (atomic, strong, readonly) NSArray<ObjectType> *changedObjects;
// Enumerates the indexes of the moved items, relative to the 'before' state of the fetch result after applying the removedIndexes and insertedIndexes
- (void)enumerateMovesWithBlock:(void(^)(NSUInteger fromIndex, NSUInteger toIndex))handler;
// YES if there are moved items
// returns NO if hasIncrementalChanges is NO
@property (atomic, assign, readonly) BOOL hasMoves;
// Provides a "diff" between 2 PHFetchResult objects.
+ (instancetype)changeDetailsFromFetchResult:(PHFetchResult<ObjectType> *)fromResult toFetchResult:(PHFetchResult<ObjectType> *)toResult changedObjects:(NSArray<ObjectType> *)changedObjects;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHCollectionListChangeRequest.h
//
// PHCollectionListChangeRequest.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PHChangeRequest.h>
#import <Photos/PHFetchResult.h>
@class PHCollection;
@class PHCollectionList;
@class PHObjectPlaceholder;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.15), ios(8), tvos(10))
// PHCollectionListChangeRequest can only be created or used within a -[PHPhotoLibrary performChanges:] or -[PHPhotoLibrary performChangesAndWait:] block.
OS_EXPORT
@interface PHCollectionListChangeRequest : PHChangeRequest
#pragma mark - Creating Collection Lists
+ (instancetype)creationRequestForCollectionListWithTitle:(NSString *)title;
// This can be used to fetch the newly created collection list after the change block has completed by using -localIdentifier
// It can also be added directly to collection lists within the current change block
@property (nonatomic, strong, readonly) PHObjectPlaceholder *placeholderForCreatedCollectionList;
#pragma mark - Deleting Collection Lists
// requests that the specified collection lists and all their child collections (recursively) be deleted
+ (void)deleteCollectionLists:(id<NSFastEnumeration>)collectionLists;
#pragma mark - Modifying Collection Lists
// if the collection list does not allow the type of change requested, these methods will raise an exception, call canPerformEditOperation: on the collection list to determine if the type of edit operation is allowed.
+ (nullable instancetype)changeRequestForCollectionList:(PHCollectionList *)collectionList;
// to add, remove or rearrange child collections in a collection list, passing in the fetched collections in that collection list will ensure that the child collection positions are tracked correctly in the case that the collection list has been externally edited after the fetch, but before this change is applied
+ (nullable instancetype)changeRequestForCollectionList:(PHCollectionList *)collectionList childCollections:(PHFetchResult<__kindof PHCollection *> *)childCollections;
@property (nonatomic, strong, readwrite) NSString *title;
#pragma mark - Mutating child collections
// A PHCollection can only belong to a single parent PHCollection
- (void)addChildCollections:(id<NSFastEnumeration>)collections;
- (void)insertChildCollections:(id<NSFastEnumeration>)collections atIndexes:(NSIndexSet *)indexes;
- (void)removeChildCollections:(id<NSFastEnumeration>)collections;
- (void)removeChildCollectionsAtIndexes:(NSIndexSet *)indexes;
- (void)replaceChildCollectionsAtIndexes:(NSIndexSet *)indexes withChildCollections:(id<NSFastEnumeration>)collections;
// The move removes the child collections at fromIndexes first then inserts those collections at the toIndex, so toIndex should point to a location based on the updated indexes after having removed the child collections at fromIndexes
- (void)moveChildCollectionsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)toIndex;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHObject.h
//
// PHObject.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.13), ios(8), tvos(10))
@class PHPhotoLibrary;
OS_EXPORT
@interface PHObject : NSObject <NSCopying>
// Returns an identifier which persistently identifies the object on a given device
@property (nonatomic, copy, readonly) NSString *localIdentifier;
@end
// PHObjectPlaceholder represents a model object future , vended by change requests when creating a model object. PHObjectPlaceholder is a read-only object and may be used as a proxy for the real object that will be created both inside and outside of the change block. Will compare isEqual: to the fetched model object after the change block is performed.
OS_EXPORT API_AVAILABLE(macos(10.15))
@interface PHObjectPlaceholder : PHObject
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHAssetResource.h
//
// PHAssetResource.h
// Photos
//
// Copyright © 2015 Apple Inc. All rights reserved.
//
#import <Photos/PhotosTypes.h>
@class PHAsset;
@class PHLivePhoto;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.15), ios(9), tvos(10))
OS_EXPORT
@interface PHAssetResource : NSObject
@property (nonatomic, assign, readonly) PHAssetResourceType type;
@property (nonatomic, copy, readonly) NSString *assetLocalIdentifier;
@property (nonatomic, copy, readonly) NSString *uniformTypeIdentifier;
@property (nonatomic, copy, readonly) NSString *originalFilename;
#pragma mark - Getting resources
+ (NSArray<PHAssetResource *> *)assetResourcesForAsset:(PHAsset *)asset;
+ (NSArray<PHAssetResource *> *)assetResourcesForLivePhoto:(PHLivePhoto *)livePhoto API_AVAILABLE(ios(9.1));
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHAssetChangeRequest.h
//
// PHAssetChangeRequest.h
// Photos
//
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PHAsset.h>
#import <Photos/PHChangeRequest.h>
#import <Photos/PHContentEditingOutput.h>
@class UIImage;
@class CLLocation;
@class PHAssetResource;
@class PHObjectPlaceholder;
@class PHContentEditingInputRequestOptions;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.15), ios(8), tvos(10))
// PHAssetChangeRequest can only be created or used within a -[PHPhotoLibrary performChanges:] or -[PHPhotoLibrary performChangesAndWait:] block.
OS_EXPORT
@interface PHAssetChangeRequest : PHChangeRequest
#pragma mark - Creating Assets
// Basic asset creation. For finer-grained control, see PHAssetCreationRequest.
+ (instancetype)creationRequestForAssetFromImage:(UIImage *)image;
+ (nullable instancetype)creationRequestForAssetFromImageAtFileURL:(NSURL *)fileURL;
+ (nullable instancetype)creationRequestForAssetFromVideoAtFileURL:(NSURL *)fileURL;
// This can be used to fetch the newly created asset after the change block has completed by using -localIdentifier
// It can also be added directly to collections within the current change block
@property (nonatomic, strong, readonly, nullable) PHObjectPlaceholder *placeholderForCreatedAsset;
#pragma mark - Deleting Assets
+ (void)deleteAssets:(id<NSFastEnumeration>)assets;
#pragma mark - Modifying Assets
// if the asset does not allow the type of change requested, these methods will raise an exception, call canPerformEditOperation: on the asset to determine if the type of edit operation is allowed.
+ (instancetype)changeRequestForAsset:(PHAsset *)asset;
@property (nonatomic, strong, readwrite, nullable) NSDate *creationDate;
@property (nonatomic, strong, readwrite, nullable) CLLocation *location;
@property (nonatomic, assign, readwrite, getter=isFavorite) BOOL favorite;
// a hidden asset will be excluded from moment collections, but may still be included in other smart or regular album collections
@property (nonatomic, assign, readwrite, getter=isHidden) BOOL hidden;
#pragma mark - Editing Asset Contents
@property (nonatomic, strong, readwrite, nullable) PHContentEditingOutput *contentEditingOutput;
- (void)revertAssetContentToOriginal;
@end
typedef NSUInteger PHContentEditingInputRequestID;
OS_EXPORT
@interface PHContentEditingInputRequestOptions : NSObject
// Block to be provided by the client, used to determine if the given adjustment data can be handled (i.e. can be decoded and rendered).
@property (nonatomic, copy) BOOL (^canHandleAdjustmentData)(PHAdjustmentData *adjustmentData);
// Used if data is not available locally and needs to be retrieved from iCloud.
@property (nonatomic, assign, getter = isNetworkAccessAllowed) BOOL networkAccessAllowed;
@property (nonatomic, copy, nullable) void (^progressHandler)(double progress, BOOL *stop);
@end
@interface PHAsset (PHContentEditingInput)
// Completion and progress handlers are called on an arbitrary serial queue.
- (PHContentEditingInputRequestID)requestContentEditingInputWithOptions:(nullable PHContentEditingInputRequestOptions *)options completionHandler:(void (^)(PHContentEditingInput *__nullable contentEditingInput, NSDictionary *info))completionHandler;
- (void)cancelContentEditingInputRequest:(PHContentEditingInputRequestID)requestID;
@end
// Completion handler info dictionary keys
extern NSString *const PHContentEditingInputResultIsInCloudKey;
extern NSString *const PHContentEditingInputCancelledKey;
extern NSString *const PHContentEditingInputErrorKey;
@interface PHContentEditingOutput (PHAssetChangeRequest)
// Create a PHContentEditingOutput from a newly created asset within the change request block
- (instancetype)initWithPlaceholderForCreatedAsset:(PHObjectPlaceholder *)placeholderForCreatedAsset;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHLivePhoto.h
//
// PHLivePhoto.h
// Photos
//
// Copyright © 2015 Apple Inc. All rights reserved.
//
#import <Photos/PhotosTypes.h>
#import <CoreGraphics/CGGeometry.h>
@class UIImage;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.15), ios(9.1), tvos(10))
typedef int32_t PHLivePhotoRequestID;
static const PHLivePhotoRequestID PHLivePhotoRequestIDInvalid = 0;
/// These keys may be found in the info dictionary delivered to a live photo request result handler block.
extern NSString * const PHLivePhotoInfoErrorKey; // key : NSError decribing an error that has occurred while creating the live photo
extern NSString * const PHLivePhotoInfoIsDegradedKey; // key : NSNumber containing a BOOL, YES whenever the deivered live photo object does not contain all content required for full playback.
extern NSString * const PHLivePhotoInfoCancelledKey; // key : NSNumber containing a BOOL, YES when the result handler is being called after the request has been cancelled.
OS_EXPORT API_AVAILABLE(macos(10.12))
@interface PHLivePhoto : NSObject <NSCopying, NSSecureCoding>
- (instancetype)init NS_UNAVAILABLE;
/// The dimensions of the live photo measured in pixels.
@property (readonly, nonatomic) CGSize size API_AVAILABLE(macos(10.12));
#pragma mark - Export
/// Requests a Live Photo from the given resource URLs. The result handler will be called multiple times to deliver new PHLivePhoto instances with increasingly more content. If a placeholder image is provided, the result handler will first be invoked synchronously to deliver a live photo containing only the placeholder image. Subsequent invocations of the result handler will occur on the main queue.
// The targetSize and contentMode parameters are used to resize the live photo content if needed. If targetSize is equal to CGRectZero, content will not be resized.
// When using this method to provide content for a PHLivePhotoView, each live photo instance delivered via the result handler should be passed to -[PHLivePhotoView setLivePhoto:].
+ (PHLivePhotoRequestID)requestLivePhotoWithResourceFileURLs:(NSArray<NSURL *> *)fileURLs placeholderImage:(nullable UIImage *)image targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode resultHandler:(void(^)(PHLivePhoto *_Nullable livePhoto, NSDictionary *info))resultHandler;
/// Cancels the loading of a PHLivePhoto. The request's completion handler will be called.
+ (void)cancelLivePhotoRequestWithRequestID:(PHLivePhotoRequestID)requestID;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHAssetResourceManager.h
//
// PHAssetResourceManager.h
// Photos
//
// Copyright © 2015 Apple Inc. All rights reserved.
//
#import <Photos/PhotosTypes.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.15), ios(9), tvos(10))
// Uniquely identify a resource data request
typedef int32_t PHAssetResourceDataRequestID;
static const PHAssetResourceDataRequestID PHInvalidAssetResourceDataRequestID = 0;
// Progress handler, called in an arbitrary serial queue.
typedef void (^PHAssetResourceProgressHandler)(double progress);
@class PHAssetResource;
OS_EXPORT
@interface PHAssetResourceRequestOptions : NSObject <NSCopying>
@property (nonatomic, assign, getter=isNetworkAccessAllowed) BOOL networkAccessAllowed;
@property (nonatomic, copy, nullable) PHAssetResourceProgressHandler progressHandler;
@end
OS_EXPORT
@interface PHAssetResourceManager : NSObject
+ (PHAssetResourceManager *)defaultManager;
// Handlers are called on an arbitrary serial queue. The lifetime of the data is not guaranteed beyond that of the handler.
- (PHAssetResourceDataRequestID)requestDataForAssetResource:(PHAssetResource *)resource
options:(nullable PHAssetResourceRequestOptions *)options
dataReceivedHandler:(void (^)(NSData *data))handler
completionHandler:(void(^)(NSError *__nullable error))completionHandler;
// Handlers are called on an arbitrary serial queue.
- (void)writeDataForAssetResource:(PHAssetResource *)resource
toFile:(NSURL *)fileURL
options:(nullable PHAssetResourceRequestOptions *)options
completionHandler:(void(^)(NSError *__nullable error))completionHandler;
- (void)cancelDataRequest:(PHAssetResourceDataRequestID)requestID;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHFetchOptions.h
//
// PHFetchOptions.h
// Photos
//
// Copyright (c) 2014 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PhotosTypes.h>
@class PHObject;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.13), ios(8), tvos(10))
OS_EXPORT
@interface PHFetchOptions : NSObject <NSCopying>
// Some predicates / sorts may be suboptimal and we will log
@property (nonatomic, strong, nullable) NSPredicate *predicate;
@property (nonatomic, strong, nullable) NSArray<NSSortDescriptor *> *sortDescriptors;
// Whether hidden assets are included in fetch results. Defaults to NO
@property (nonatomic, assign) BOOL includeHiddenAssets;
// Whether hidden burst assets are included in fetch results. Defaults to NO
@property (nonatomic, assign) BOOL includeAllBurstAssets API_AVAILABLE(macos(10.15));
// The asset source types included in the fetch results. Defaults to PHAssetSourceTypeNone.
// If set to PHAssetSourceTypeNone the asset source types included in the fetch results are inferred from the type of query performed (see PHAsset fetchAssetsWithOptions:)
@property (nonatomic, assign) PHAssetSourceType includeAssetSourceTypes API_AVAILABLE(ios(9));
// Limits the maximum number of objects returned in the fetch result, a value of 0 means no limit. Defaults to 0.
@property (nonatomic, assign, readwrite) NSUInteger fetchLimit API_AVAILABLE(ios(9));
// Whether the owner of this object is interested in incremental change details for the results of this fetch (see PHChange)
// Defaults to YES
@property (nonatomic, assign) BOOL wantsIncrementalChangeDetails;
@end
API_AVAILABLE_END
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHImageManager.h
//
// PHImageManager.h
// Photos
//
// Copyright (c) 2013-2014 Apple Inc. All rights reserved.
//
#import <TargetConditionals.h>
#import <AVFoundation/AVFoundation.h>
#import <Photos/PhotosTypes.h>
#import <ImageIO/CGImageProperties.h>
@class UIImage;
@class PHAsset;
@class PHLivePhoto;
#ifdef __cplusplus
typedef NS_ENUM(NSInteger, UIImageOrientation);
#endif
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(ios(8), tvos(10))
API_AVAILABLE_BEGIN(macos(10.13))
#pragma mark - PHImageRequestOptions - Configuration
typedef NS_ENUM(NSInteger, PHImageRequestOptionsVersion) {
PHImageRequestOptionsVersionCurrent = 0, // version with edits (aka adjustments) rendered or unadjusted version if there is no edits
PHImageRequestOptionsVersionUnadjusted, // original version without any adjustments
PHImageRequestOptionsVersionOriginal // original version, in the case of a combined format the highest fidelity format will be returned (e.g. RAW for a RAW+JPG source image)
};
typedef NS_ENUM(NSInteger, PHImageRequestOptionsDeliveryMode) {
PHImageRequestOptionsDeliveryModeOpportunistic = 0, // client may get several image results when the call is asynchronous or will get one result when the call is synchronous
PHImageRequestOptionsDeliveryModeHighQualityFormat = 1, // client will get one result only and it will be as asked or better than asked
PHImageRequestOptionsDeliveryModeFastFormat = 2 // client will get one result only and it may be degraded
};
typedef NS_ENUM(NSInteger, PHImageRequestOptionsResizeMode) {
PHImageRequestOptionsResizeModeNone = 0, // no resize
PHImageRequestOptionsResizeModeFast, // use targetSize as a hint for optimal decoding when the source image is a compressed format (i.e. subsampling), the delivered image may be larger than targetSize
PHImageRequestOptionsResizeModeExact, // same as above but also guarantees the delivered image is exactly targetSize (must be set when a normalizedCropRect is specified)
};
// Progress handler, called in an arbitrary serial queue. Only called when the data is not available locally and is retrieved from iCloud.
typedef void (^PHAssetImageProgressHandler)(double progress, NSError *__nullable error, BOOL *stop, NSDictionary *__nullable info);
#pragma mark -
OS_EXPORT
@interface PHImageRequestOptions : NSObject <NSCopying>
@property (nonatomic, assign) PHImageRequestOptionsVersion version; // version
@property (nonatomic, assign) PHImageRequestOptionsDeliveryMode deliveryMode; // delivery mode. Defaults to PHImageRequestOptionsDeliveryModeOpportunistic
@property (nonatomic, assign) PHImageRequestOptionsResizeMode resizeMode; // resize mode. Does not apply when size is PHImageManagerMaximumSize. Defaults to PHImageRequestOptionsResizeModeFast
@property (nonatomic, assign) CGRect normalizedCropRect; // specify crop rectangle in unit coordinates of the original image, such as a face. Defaults to CGRectZero (not applicable)
@property (nonatomic, assign, getter=isNetworkAccessAllowed) BOOL networkAccessAllowed; // if necessary will download the image from iCloud (client can monitor or cancel using progressHandler). Defaults to NO (see start/stopCachingImagesForAssets)
@property (nonatomic, assign, getter=isSynchronous) BOOL synchronous; // return only a single result, blocking until available (or failure). Defaults to NO
@property (nonatomic, copy, nullable) PHAssetImageProgressHandler progressHandler; // provide caller a way to be told how much progress has been made prior to delivering the data when it comes from iCloud. Defaults to nil, shall be set by caller
@end
API_AVAILABLE_END // macos(10.13)
API_AVAILABLE_BEGIN(macos(10.15))
#pragma mark -
OS_EXPORT
@interface PHLivePhotoRequestOptions : NSObject <NSCopying>
@property (nonatomic, assign) PHImageRequestOptionsVersion version; // version
@property (nonatomic, assign) PHImageRequestOptionsDeliveryMode deliveryMode;
@property (nonatomic, assign, getter=isNetworkAccessAllowed) BOOL networkAccessAllowed;
@property (nonatomic, copy, nullable) PHAssetImageProgressHandler progressHandler;
@end
#pragma mark - PHVideoRequestOptions - Configuration
typedef NS_ENUM(NSInteger, PHVideoRequestOptionsVersion) {
PHVideoRequestOptionsVersionCurrent = 0, // version with edits (aka adjustments) rendered or unadjusted version if there is no edits
PHVideoRequestOptionsVersionOriginal // original version
};
typedef NS_ENUM(NSInteger, PHVideoRequestOptionsDeliveryMode) { // only apply with PHVideoRequestOptionsVersionCurrent
PHVideoRequestOptionsDeliveryModeAutomatic = 0, // let us pick the quality (typ. PHVideoRequestOptionsDeliveryModeMediumQualityFormat for streamed AVPlayerItem or AVAsset, or PHVideoRequestOptionsDeliveryModeHighQualityFormat for AVAssetExportSession)
PHVideoRequestOptionsDeliveryModeHighQualityFormat = 1, // best quality
PHVideoRequestOptionsDeliveryModeMediumQualityFormat = 2, // medium quality (typ. 720p), currently only supported for AVPlayerItem or AVAsset when streaming from iCloud (will systematically default to PHVideoRequestOptionsDeliveryModeHighQualityFormat if locally available)
PHVideoRequestOptionsDeliveryModeFastFormat = 3 // fastest available (typ. 360p MP4), currently only supported for AVPlayerItem or AVAsset when streaming from iCloud (will systematically default to PHVideoRequestOptionsDeliveryModeHighQualityFormat if locally available)
};
// Progress handler, called in an arbitrary serial queue: only called when the data is not available locally and is retrieved from iCloud
typedef void (^PHAssetVideoProgressHandler)(double progress, NSError *__nullable error, BOOL *stop, NSDictionary *__nullable info);
OS_EXPORT
@interface PHVideoRequestOptions : NSObject
@property (nonatomic, assign, getter=isNetworkAccessAllowed) BOOL networkAccessAllowed;
@property (nonatomic, assign) PHVideoRequestOptionsVersion version;
@property (nonatomic, assign) PHVideoRequestOptionsDeliveryMode deliveryMode;
@property (nonatomic, copy, nullable) PHAssetVideoProgressHandler progressHandler;
@end
API_AVAILABLE_END // macos(10.15)
API_AVAILABLE_BEGIN(macos(10.13))
#pragma mark - PHImageManager - Fetching
// Uniquely identify a cancellable async request
typedef int32_t PHImageRequestID;
static const PHImageRequestID PHInvalidImageRequestID = 0;
// Size to pass when requesting the original image or the largest rendered image available (resizeMode will be ignored)
extern CGSize const PHImageManagerMaximumSize;
// Result's handler info dictionary keys
extern NSString *const PHImageResultIsInCloudKey; // key (NSNumber): result is in iCloud, meaning a new request will need to get issued (with networkAccessAllowed set) to get the result
extern NSString *const PHImageResultIsDegradedKey; // key (NSNumber): result is a degraded image (only with async requests), meaning other images will be sent unless the request is cancelled in the meanwhile (note that the other request may fail if, for example, data is not available locally and networkAccessAllowed was not specified)
extern NSString *const PHImageResultRequestIDKey; // key (NSNumber): Request ID of the request for this result
extern NSString *const PHImageCancelledKey; // key (NSNumber): result is not available because the request was cancelled
extern NSString *const PHImageErrorKey; // key (NSError): NSFileManager or iCloud Photo Library errors
// Note that all sizes are in pixels
OS_EXPORT
@interface PHImageManager : NSObject
+ (PHImageManager *)defaultManager;
#pragma mark - Image
/**
@abstract Request an image representation for the specified asset.
@param asset The asset whose image data is to be loaded.
@param targetSize The target size of image to be returned.
@param contentMode An option for how to fit the image to the aspect ratio of the requested size.
If the asset's aspect ratio does not match that of the given targetSize, contentMode determines how the image will be resized.
PHImageContentModeAspectFit: Fit the asked size by maintaining the aspect ratio, the delivered image may not necessarily be the asked targetSize (see PHImageRequestOptionsDeliveryMode and PHImageRequestOptionsResizeMode)
PHImageContentModeAspectFill: Fill the asked size, some portion of the content may be clipped, the delivered image may not necessarily be the asked targetSize (see PHImageRequestOptionsDeliveryMode and PHImageRequestOptionsResizeMode)
PHImageContentModeDefault: Use PHImageContentModeDefault when size is PHImageManagerMaximumSize (though no scaling/cropping will be done on the result)
@param options Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors.
If -[PHImageRequestOptions isSynchronous] returns NO (or options is nil), resultHandler may be called 1 or more times. Typically in this case, resultHandler will be called asynchronously on the main thread with the requested results. However, if deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic, resultHandler may be called synchronously on the calling thread if any image data is immediately available. If the image data returned in this first pass is of insufficient quality, resultHandler will be called again, asychronously on the main thread at a later time with the "correct" results. If the request is cancelled, resultHandler may not be called at all.
If -[PHImageRequestOptions isSynchronous] returns YES, resultHandler will be called exactly once, synchronously and on the calling thread. Synchronous requests cannot be cancelled.
@param resultHandler A block that is called one or more times either synchronously on the current thread or asynchronously on the main thread depending on the options specified in the PHImageRequestOptions options parameter.
@return A numeric identifier for the request. If you need to cancel the request before it completes, pass this identifier to the cancelImageRequest: method.
*/
- (PHImageRequestID)requestImageForAsset:(PHAsset *)asset targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(UIImage *_Nullable result, NSDictionary *_Nullable info))resultHandler;
/**
@abstract Request largest represented image as data bytes for the specified asset.
@param asset The asset whose image data is to be loaded.
@param options Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors.
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.
@param 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).
*/
#ifdef __cplusplus
- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(NSData *_Nullable imageData, NSString *_Nullable dataUTI, UIImageOrientation orientation, NSDictionary *_Nullable info))resultHandler API_DEPRECATED_WITH_REPLACEMENT("-requestImageDataAndOrientationForAsset:options:resultHandler:", ios(8, 13), tvos(8, 13)) API_UNAVAILABLE(macos);
#else
- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(NSData *_Nullable imageData, NSString *_Nullable dataUTI, NSInteger/*UIImageOrientation*/ orientation, NSDictionary *_Nullable info))resultHandler API_DEPRECATED_WITH_REPLACEMENT("-requestImageDataAndOrientationForAsset:options:resultHandler:", ios(8, 13), tvos(8, 13)) API_UNAVAILABLE(macos);
#endif
/**
@abstract Request largest represented image as data bytes and EXIF orientation for the specified asset.
@param asset The asset whose image data is to be loaded.
@param options Options specifying how Photos should handle the request, format the requested image, and notify your app of progress or errors.
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.
@param 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.
*/
- (PHImageRequestID)requestImageDataAndOrientationForAsset:(PHAsset *)asset options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(NSData *_Nullable imageData, NSString *_Nullable dataUTI, CGImagePropertyOrientation orientation, NSDictionary *_Nullable info))resultHandler API_AVAILABLE(macos(10.15), ios(13), tvos(13));
- (void)cancelImageRequest:(PHImageRequestID)requestID;
#pragma mark - Live Photo
/// 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.
- (PHImageRequestID)requestLivePhotoForAsset:(PHAsset *)asset targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(nullable PHLivePhotoRequestOptions *)options resultHandler:(void (^)(PHLivePhoto *__nullable livePhoto, NSDictionary *__nullable info))resultHandler API_AVAILABLE(macos(10.15), ios(9.1));
#pragma mark - Video
// Playback only. The result handler is called on an arbitrary queue.
- (PHImageRequestID)requestPlayerItemForVideo:(PHAsset *)asset options:(nullable PHVideoRequestOptions *)options resultHandler:(void (^)(AVPlayerItem *__nullable playerItem, NSDictionary *__nullable info))resultHandler API_AVAILABLE(macos(10.15));
// Export. The result handler is called on an arbitrary queue.
- (PHImageRequestID)requestExportSessionForVideo:(PHAsset *)asset options:(nullable PHVideoRequestOptions *)options exportPreset:(NSString *)exportPreset resultHandler:(void (^)(AVAssetExportSession *__nullable exportSession, NSDictionary *__nullable info))resultHandler API_AVAILABLE(macos(10.15));
// Everything else. The result handler is called on an arbitrary queue.
- (PHImageRequestID)requestAVAssetForVideo:(PHAsset *)asset options:(nullable PHVideoRequestOptions *)options resultHandler:(void (^)(AVAsset *__nullable asset, AVAudioMix *__nullable audioMix, NSDictionary *__nullable info))resultHandler API_AVAILABLE(macos(10.15));
@end
API_AVAILABLE_END // macos(10.13)
API_AVAILABLE_BEGIN(macos(10.15))
#pragma mark - PHCachingImageManager - Preheating
OS_EXPORT
@interface PHCachingImageManager : PHImageManager
// During fast scrolling clients should set this to improve responsiveness
@property (nonatomic, assign) BOOL allowsCachingHighQualityImages; // Defaults to YES
// Asynchronous image preheating (aka caching), note that only image sources are cached (no crop or exact resize is ever done on them at the time of caching, only at the time of delivery when applicable).
// The options values shall exactly match the options values used in loading methods. If two or more caching requests are done on the same asset using different options or different targetSize the first
// caching request will have precedence (until it is stopped)
- (void)startCachingImagesForAssets:(NSArray<PHAsset *> *)assets targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(nullable PHImageRequestOptions *)options;
- (void)stopCachingImagesForAssets:(NSArray<PHAsset *> *)assets targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(nullable PHImageRequestOptions *)options;
- (void)stopCachingImagesForAllAssets;
@end
API_AVAILABLE_END // macos(10.15)
API_AVAILABLE_END // ios(8), tvos(10)
NS_ASSUME_NONNULL_END
// ========== Photos.framework/Headers/PHChangeRequest.h
//
// PHChangeRequest.h
// PhotoKit
//
// Copyright (c) 2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
OS_EXPORT API_AVAILABLE(macos(10.15), ios(13), tvos(13))
@interface PHChangeRequest : NSObject
@end
// ========== Photos.framework/Headers/PHContentEditingInput.h
//
// PHContentEditingInput.h
// Photos
//
// Copyright (c) 2014 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Photos/PhotosTypes.h>
@class PHAdjustmentData;
@class AVAsset;
@class CLLocation;
@class PHLivePhoto;
@class UIImage;
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE_BEGIN(macos(10.11), ios(8), tvos(10))
OS_EXPORT
@interface PHContentEditingInput : NSObject