|
| 1 | +// |
| 2 | +// PHCollection.h |
| 3 | +// Photos |
| 4 | +// |
| 5 | +// Copyright (c) 2013 Apple Inc. All rights reserved. |
| 6 | +// |
| 7 | + |
| 8 | +#import <Photos/PHObject.h> |
| 9 | +#import <Photos/PHFetchResult.h> |
| 10 | +#import <Photos/PhotosTypes.h> |
| 11 | + |
| 12 | +@class PHAsset, PHCollectionList, PHFetchResult, PHFetchOptions; |
| 13 | +@class CLLocation; |
| 14 | + |
| 15 | +NS_ASSUME_NONNULL_BEGIN |
| 16 | + |
| 17 | +@interface PHCollection (Private) |
| 18 | + |
| 19 | +@property (nonatomic, assign, readonly) BOOL canContainAssets; |
| 20 | +@property (nonatomic, assign, readonly) BOOL canContainCollections; |
| 21 | + |
| 22 | +#pragma mark - Capabilities |
| 23 | + |
| 24 | +- (BOOL)canPerformEditOperation:(PHCollectionEditOperation)anOperation; |
| 25 | + |
| 26 | + |
| 27 | +#pragma mark - Fetching collections |
| 28 | + |
| 29 | ++ (PHFetchResult<PHCollection *> *)fetchCollectionsInCollectionList:(PHCollectionList *)collectionList options:(nullable PHFetchOptions *)options; |
| 30 | ++ (PHFetchResult<PHCollection *> *)fetchTopLevelUserCollectionsWithOptions:(nullable PHFetchOptions *)options; |
| 31 | + |
| 32 | +@end |
| 33 | + |
| 34 | + |
| 35 | +@interface PHAssetCollection (Private) |
| 36 | + |
| 37 | +@property (nonatomic, assign, readonly) PHAssetCollectionType assetCollectionType; |
| 38 | +@property (nonatomic, assign, readonly) PHAssetCollectionSubtype assetCollectionSubtype; |
| 39 | + |
| 40 | +// These counts are just estimates; the actual count of objects returned from a fetch should be used if you care about accuracy. Returns NSNotFound if a count cannot be quickly returned. |
| 41 | +@property (nonatomic, assign, readonly) NSUInteger estimatedAssetCount; |
| 42 | + |
| 43 | +@property (nonatomic, strong, readonly, nullable) NSDate *startDate; |
| 44 | +@property (nonatomic, strong, readonly, nullable) NSDate *endDate; |
| 45 | + |
| 46 | +@property (nonatomic, strong, readonly, nullable) CLLocation *approximateLocation; |
| 47 | +@property (nonatomic, strong, readonly) NSArray<NSString *> *localizedLocationNames; |
| 48 | + |
| 49 | + |
| 50 | +#pragma mark - Fetching asset collections |
| 51 | + |
| 52 | +// Fetch asset collections of a single type matching the provided local identifiers (type is inferred from the local identifiers) |
| 53 | ++ (PHFetchResult<PHAssetCollection *> *)fetchAssetCollectionsWithLocalIdentifiers:(NSArray<NSString *> *)identifiers options:(nullable PHFetchOptions *)options; |
| 54 | + |
| 55 | +// Fetch asset collections of a single type and subtype provided (use PHAssetCollectionSubtypeAny to match all subtypes) |
| 56 | ++ (PHFetchResult<PHAssetCollection *> *)fetchAssetCollectionsWithType:(PHAssetCollectionType)type subtype:(PHAssetCollectionSubtype)subtype options:(nullable PHFetchOptions *)options; |
| 57 | + |
| 58 | +// Smart Albums are not supported, only Albums and Moments |
| 59 | ++ (PHFetchResult<PHAssetCollection *> *)fetchAssetCollectionsContainingAsset:(PHAsset *)asset withType:(PHAssetCollectionType)type options:(nullable PHFetchOptions *)options; |
| 60 | + |
| 61 | +// assetGroupURLs are URLs retrieved from ALAssetGroup's ALAssetsGroupPropertyURL |
| 62 | ++ (PHFetchResult<PHAssetCollection *> *)fetchAssetCollectionsWithALAssetGroupURLs:(NSArray<NSURL *> *)assetGroupURLs options:(nullable PHFetchOptions *)options; |
| 63 | + |
| 64 | + |
| 65 | +#pragma mark - Fetching moment asset collections |
| 66 | + |
| 67 | ++ (PHFetchResult<PHAssetCollection *> *)fetchMomentsInMomentList:(PHCollectionList *)momentList options:(nullable PHFetchOptions *)options; |
| 68 | ++ (PHFetchResult<PHAssetCollection *> *)fetchMomentsWithOptions:(nullable PHFetchOptions *)options; |
| 69 | + |
| 70 | + |
| 71 | +#pragma mark - Transient asset collections |
| 72 | +// These asset collections are only in-memory and are not persisted to disk |
| 73 | + |
| 74 | ++ (PHAssetCollection *)transientAssetCollectionWithAssets:(NSArray<PHAsset *> *)assets title:(nullable NSString *)title; |
| 75 | ++ (PHAssetCollection *)transientAssetCollectionWithAssetFetchResult:(PHFetchResult<PHAsset *> *)fetchResult title:(nullable NSString *)title; |
| 76 | + |
| 77 | + |
| 78 | +@end |
| 79 | + |
| 80 | + |
| 81 | +@interface PHCollectionList (Private) |
| 82 | + |
| 83 | +@property (nonatomic, assign, readonly) PHCollectionListType collectionListType; |
| 84 | +@property (nonatomic, assign, readonly) PHCollectionListSubtype collectionListSubtype; |
| 85 | + |
| 86 | +@property (nonatomic, strong, readonly, nullable) NSDate *startDate; |
| 87 | +@property (nonatomic, strong, readonly, nullable) NSDate *endDate; |
| 88 | + |
| 89 | +@property (nonatomic, strong, readonly) NSArray<NSString *> *localizedLocationNames; |
| 90 | + |
| 91 | + |
| 92 | +#pragma mark - Fetching collection lists |
| 93 | + |
| 94 | +// A PHAssetCollectionTypeMoment will be contained by a PHCollectionListSubtypeMomentListCluster and a PHCollectionListSubtypeMomentListYear |
| 95 | +// Non-moment PHAssetCollections will only be contained by a single collection list |
| 96 | ++ (PHFetchResult<PHCollectionList *> *)fetchCollectionListsContainingCollection:(PHCollection *)collection options:(nullable PHFetchOptions *)options; |
| 97 | + |
| 98 | +// Fetch collection lists of a single type matching the provided local identifiers (type is inferred from the local identifiers) |
| 99 | ++ (PHFetchResult<PHCollectionList *> *)fetchCollectionListsWithLocalIdentifiers:(NSArray<NSString *> *)identifiers options:(nullable PHFetchOptions *)options; |
| 100 | + |
| 101 | +// Fetch asset collections of a single type and subtype provided (use PHCollectionListSubtypeAny to match all subtypes) |
| 102 | ++ (PHFetchResult<PHCollectionList *> *)fetchCollectionListsWithType:(PHCollectionListType)collectionListType subtype:(PHCollectionListSubtype)subtype options:(nullable PHFetchOptions *)options; |
| 103 | + |
| 104 | + |
| 105 | +#pragma mark - Fetching moment collection lists |
| 106 | + |
| 107 | ++ (PHFetchResult<PHCollectionList *> *)fetchMomentListsWithSubtype:(PHCollectionListSubtype)momentListSubtype containingMoment:(PHAssetCollection *)moment options:(nullable PHFetchOptions *)options; |
| 108 | ++ (PHFetchResult<PHCollectionList *> *)fetchMomentListsWithSubtype:(PHCollectionListSubtype)momentListSubtype options:(nullable PHFetchOptions *)options; |
| 109 | + |
| 110 | + |
| 111 | +#pragma mark - Transient collection lists |
| 112 | + |
| 113 | +// These collection lists are only in-memory and are not persisted to disk |
| 114 | ++ (PHCollectionList *)transientCollectionListWithCollections:(NSArray<PHCollection *> *)collections title:(nullable NSString *)title; |
| 115 | ++ (PHCollectionList *)transientCollectionListWithCollectionsFetchResult:(PHFetchResult<PHCollection *> *)fetchResult title:(nullable NSString *)title; |
| 116 | + |
| 117 | +@end |
| 118 | + |
| 119 | +NS_ASSUME_NONNULL_END |
0 commit comments