Skip to content

Photos tvOS xcode13.0 beta1

Rachel Kang edited this page Jul 22, 2021 · 3 revisions

#Photos.framework https://github.com/xamarin/xamarin-macios/pull/12163

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h	2021-03-16 13:56:50.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h	2021-06-02 05:35:46.000000000 -0400
@@ -55,6 +55,9 @@
 
 @property (nonatomic, assign, readonly) PHAssetSourceType sourceType API_AVAILABLE(ios(9));
 
+// only applies to adjusted assets
+@property (nonatomic, assign, readonly, nullable) NSString *adjustmentFormatIdentifier API_AVAILABLE(macos(12), ios(15), tvos(15));
+
 #pragma mark - Capabilities
 
 - (BOOL)canPerformEditOperation:(PHAssetEditOperation)editOperation API_AVAILABLE(macos(10.15));
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHCloudIdentifier.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHCloudIdentifier.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHCloudIdentifier.h	2021-03-16 13:56:49.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHCloudIdentifier.h	2021-06-02 12:44:35.000000000 -0400
@@ -2,22 +2,24 @@
 //  PHCloudIdentifier.h
 //  Photos
 //
-//  Copyright © 2017 Apple, Inc. All rights reserved.
+//  Copyright © 2021 Apple, Inc. All rights reserved.
 //
 
 #import <Photos/PHPhotoLibrary.h>
 
 NS_ASSUME_NONNULL_BEGIN
-API_AVAILABLE_BEGIN(macos(10.13))
 
-API_UNAVAILABLE_BEGIN(ios, tvos, macCatalyst)
+API_AVAILABLE_BEGIN(macos(10.13), ios(15), tvos(15))
 
 
 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;
+/// DEPRECATED: 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
+
+API_DEPRECATED_WITH_REPLACEMENT("Check for PHPhotosErrorIdentifierNotFound in PHCloudIdentifierMapping.error", macos(10.13, 12)) API_UNAVAILABLE(ios, macCatalyst, tvos);
+
 
 @property (nonatomic, readonly) NSString *stringValue; /// For use in serialization
 
@@ -25,19 +27,65 @@
 
 @end
 
+API_AVAILABLE_END
+API_AVAILABLE_BEGIN(macos(12), ios(15), tvos(15))
+
+/// Contains the cloud identifier result from looking up a local identifier via \c cloudIdentifierMappingsForLocalIdentifiers, or an \c error indicating why the lookup failed
+OS_EXPORT
+@interface PHCloudIdentifierMapping : NSObject
+@property (nonatomic, readonly, nullable) PHCloudIdentifier *cloudIdentifier; /// The cloud identifier of the resource found for this local identifier
+@property (nonatomic, readonly, nullable) NSError *error; /// error An error indicating why the \c cloudIdentifier is nil. \c PHPhotosErrorIdentifierNotFound if no resource could be found for the provided local identifier.
+@end
+
+/// Contains the local identifier result from looking up a cloud identifier via \c localIdentifierMappingsForCloudIdentifiers, or an \c error indicating why the lookup failed
+OS_EXPORT
+@interface PHLocalIdentifierMapping : NSObject
+@property (nonatomic, readonly, nullable) NSString *localIdentifier; /// The \c NSString representing the local identifier of the resource found for this cloud identifier, or nil if the match was not found.
+@property (nonatomic, readonly, nullable) NSError *error; /// An error indicating why the \c localIdentifier is nil. \c PHPhotosErrorIdentifierNotFound if no resource could be found for the provided cloud identifier. \c PHPhotosErrorMultipleLocalIdentifiersFound if the cloud identifier matched more than one photo libray resource, so there were multiple local identifiers found. The array of matching local identifiers can be retrieved from the error's user info via the \c PHLocalIdentifiersErrorKey
+@end
+
+@interface PHCloudIdentifier () <NSCopying>
+@end
+
+API_AVAILABLE_END
+
+API_AVAILABLE_BEGIN(macos(10.13), ios(15), tvos(15))
+
+
 @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;
+
+/**
+ @abstract Returns a dictionary that maps each cloud identifier from the provided array to a PLLocalIdentifierMapping result containing the local identifier found for that cloud identifier.
+ @discussion This method 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.  If the attempt to lookup a local identifier for a given cloud identifier fails, the error parameter will indicate the reason.
+ @param cloudIdentifiers The array of \c PHCloudIdentifier instances whose local identifiers are to being requested.
+ */
+- (NSDictionary <PHCloudIdentifier *, PHLocalIdentifierMapping *> *)localIdentifierMappingsForCloudIdentifiers:(NSArray<PHCloudIdentifier *> *)cloudIdentifiers API_AVAILABLE(macos(12), ios(15), tvos(15));
+
+/**
+ @abstract Returns a dictionary that maps each local identifier from the provided array to a PLCloudIdentifierMapping result containing the cloud identifier found for that local identifier
+ @discussion This method 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.  If the attempt to lookup a cloud identifier for a given local identifier fails, the error parameter will indicate the reason.
+ @param localIdentifiers The array of \c NSString instances whose cloud identifiers are to being requested.
+ */
+- (NSDictionary <NSString *, PHCloudIdentifierMapping *> *)cloudIdentifierMappingsForLocalIdentifiers:(NSArray<NSString *> *)localIdentifiers API_AVAILABLE(macos(12), ios(15), tvos(15));
+
+/// DEPRECATED: 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
+
+API_DEPRECATED_WITH_REPLACEMENT("-localIdentifierMappingsForCloudIdentifiers:", macos(10.13, 12)) API_UNAVAILABLE(ios, macCatalyst, tvos);
+
+- (NSArray<PHCloudIdentifier *> *)cloudIdentifiersForLocalIdentifiers:(NSArray<NSString *> *)localIdentifiers
+
+API_DEPRECATED_WITH_REPLACEMENT("-cloudIdentifierMappingsForLocalIdentifiers:", macos(10.13, 12)) API_UNAVAILABLE(ios, macCatalyst, tvos);
+
 
 @end
 
-/// If the local object cannot be resolved from a global identifier, PHLocalIdentifierNotFound is provided in that array slot.
-extern NSString * const PHLocalIdentifierNotFound;
+/// DEPRECATED: If the local object cannot be resolved from a global identifier, PHLocalIdentifierNotFound is provided in that array slot.
+extern NSString * const PHLocalIdentifierNotFound
 
+API_DEPRECATED_WITH_REPLACEMENT("Check for PHPhotosErrorIdentifierNotFound in PHLocalIdentifierMapping.error", macos(10.13, 12)) API_UNAVAILABLE(ios, macCatalyst, tvos);
 
-API_UNAVAILABLE_END
 
 API_AVAILABLE_END
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHError.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHError.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHError.h	2021-03-16 13:56:50.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHError.h	2021-06-02 12:44:36.000000000 -0400
@@ -11,13 +11,31 @@
 
 OS_EXPORT NSErrorDomain const PHPhotosErrorDomain;
 
+/// Array of NSString values representing local identifiers related to the specific error
+extern NSErrorUserInfoKey const PHLocalIdentifiersErrorKey API_AVAILABLE(macos(12), ios(15), tvos(15));
+
 typedef NS_ERROR_ENUM(PHPhotosErrorDomain, PHPhotosError) {
-    PHPhotosErrorInvalid = -1,
-    PHPhotosErrorUserCancelled = 3072,
-    PHPhotosErrorLibraryVolumeOffline = 3114,
-    PHPhotosErrorRelinquishingLibraryBundleToWriter = 3142,
-    PHPhotosErrorSwitchingSystemPhotoLibrary = 3143,
-    PHPhotosErrorNetworkAccessRequired API_AVAILABLE(macos(11.0), ios(14), tvos(14)) = 3164,
+    PHPhotosErrorInternalError API_AVAILABLE(macos(10.15), ios(13), tvos(13)) = -1, // An unknown, internal error occured
+
+    PHPhotosErrorUserCancelled = 3072, // The user cancelled the asset resource or editing request
+    PHPhotosErrorLibraryVolumeOffline = 3114, // The photo library is unavailable because the file system volume that contains it is not mounted (register for PHPhotoLibraryAvailabilityObserver)
+    PHPhotosErrorRelinquishingLibraryBundleToWriter = 3142, // The photo library became unavailable because the user moved, renamed, or deleted the system photo library (register for PHPhotoLibraryAvailabilityObserver)
+    PHPhotosErrorSwitchingSystemPhotoLibrary = 3143, // The photo library became unavailable because the user switched the system photo library (register for PHPhotoLibraryAvailabilityObserver)
+    PHPhotosErrorNetworkAccessRequired API_AVAILABLE(macos(11.0), ios(14), tvos(14)) = 3164, // The request for an asset resource failed because network access is required, set networkAccessAllowed = YES to enable network access
+    PHPhotosErrorIdentifierNotFound API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3201, // Identifier was not found
+    PHPhotosErrorMultipleIdentifiersFound API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3202, // More than one identifier was found
+
+    PHPhotosErrorChangeNotSupported API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3300, // The change request is not supported as configured
+    PHPhotosErrorOperationInterrupted API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3301, // Operation was interrupted and could not be completed, transient error
+    PHPhotosErrorInvalidResource API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3302, // Asset resource validation failed
+    PHPhotosErrorMissingResource API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3303, // Asset resource missing
+    PHPhotosErrorNotEnoughSpace API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3305, // Not enough space to perform the requested change
+    PHPhotosErrorRequestNotSupportedForAsset API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3306, // The request could not be completed because it is not supported for the specified asset
+    
+    PHPhotosErrorAccessRestricted API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3310, // Access restricted by system configuration
+    PHPhotosErrorAccessUserDenied API_AVAILABLE(macos(12), ios(15), tvos(15)) = 3311, // The user has denied access
+
+    PHPhotosErrorInvalid API_DEPRECATED_WITH_REPLACEMENT("PHPhotosErrorInternalError", macos(10.15, 12), ios(13, 15), tvos(13, 15)) = -1, // DEPRECATED An unknown error occured
 };
 
 #ifdef __swift__
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHLivePhotoEditingContext.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHLivePhotoEditingContext.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHLivePhotoEditingContext.h	2021-03-16 09:55:08.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PHLivePhotoEditingContext.h	2021-06-02 12:44:36.000000000 -0400
@@ -123,7 +123,7 @@
 
 /// Error code for Live Photo Editing errors (Deprecated)
 typedef NS_ENUM(NSInteger, PHLivePhotoEditingErrorCode) {
-    PHLivePhotoEditingErrorCodeUnknown API_DEPRECATED_WITH_REPLACEMENT("PHPhotosErrorInvalid", macos(10.12, 10.15)),
+    PHLivePhotoEditingErrorCodeUnknown API_DEPRECATED_WITH_REPLACEMENT("PHPhotosErrorInternalError", macos(10.12, 10.15)),
     PHLivePhotoEditingErrorCodeAborted API_DEPRECATED_WITH_REPLACEMENT("PHPhotosErrorUserCancelled", macos(10.12, 10.15)),
 } API_UNAVAILABLE(ios, tvos, macCatalyst);
 
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h	2021-03-16 09:55:09.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h	2021-06-02 11:07:41.000000000 -0400
@@ -99,6 +99,7 @@
     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,
+    PHAssetCollectionSubtypeSmartAlbumRAW API_AVAILABLE(macos(12), ios(15), tvos(15)) = 217,
 
     // Used for fetching, if you don't care about the exact subtype
     PHAssetCollectionSubtypeAny = NSIntegerMax
Clone this wiki locally