dpogue commented on code in PR #937:
URL: 
https://github.com/apache/cordova-plugin-camera/pull/937#discussion_r2627531374


##########
src/ios/CDVCamera.h:
##########
@@ -22,6 +22,29 @@
 #import <CoreLocation/CLLocationManager.h>
 #import <Cordova/CDVPlugin.h>
 
+// Since iOS 14, we can use PHPickerViewController to select images from the 
photo library
+//
+// The following condition checks if the iOS 14 SDK is available for XCode
+// which is true for XCode 12+. It does not check on runtime, if the device is 
running iOS 14+.
+// For that API_AVAILABLE(ios(14)) is used for methods declarations and 
@available(iOS 14, *) for the code.
+// The condition here makes just sure that the code can compile in XCode
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
+
+// Import UniformTypeIdentifiers.h for using UTType* things, available since 
iOS 14,
+// which replaces for e.g. kUTTypeImage with UTTypeImage, which must be used 
in the future instead
+// Currently only used for PHPickerViewController
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+
+// Import PhotosUI framework for using PHPickerViewController
+// PhotosUI is already available since iOS 8, but since we need it currently
+// only for the PHPickerViewController, we import it conditionally here
+#import <PhotosUI/PhotosUI.h>
+
+// Define a macro to indicate that iOS SDK 14+ is available for PHPicker 
related things
+#define IOS_SDK_14_AVAILABLE 1

Review Comment:
   Adding a publicly visible define in the header file is essentially expanding 
the public API of the plugin. People will start using this outside of this 
plugin when they shouldn't, and if we ever want to clean up code by removing 
this it will be a breaking change.
   
   I know it's more verbose, but it's probably better in the long run to just 
use the `__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000` check everywhere



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to