I have such code:
if (@available(iOS 13.0, *)) {
if([getMetalDevice() supportsFamily:MTLGPUFamilyApple3])
pixelFormat = MTLPixelFormatBGRA10_XR;
else
pixelFormat = MTLPixelFormatBGRA8Unorm;
}
It works in Xcode 11, but doesn't work in Xcode 10.3.
A preprocessor says it doesn't know what is MTLGPUFamilyApple3 (which was introduced in iOS 13).
I tried to use a preprocessor macro:
#define isIOS13 (floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_13_0)
but a preprocessor complains Function-like macro 'floor' is not defined.
The same for
#define isIOS13 (int(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_13_0)
I need to use both Xcode 10.3 ( iOS 12.4 ) and Xcode 11 ( iOS 13.0 ) because of stability reasons.
What can I do to make my code work in both Xcodes?
#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
if([getMetalDevice() supportsFamily:MTLGPUFamilyApple3])
pixelFormat = MTLPixelFormatBGRA10_XR;
else
#else
{
#endif
pixelFormat = MTLPixelFormatBGRA8Unorm;
}
But you should use this code only if you provide some opensource library that support several Xcodes.
If this is part of yours project, you should just migrate to new Xcode and doesn't overcomplicate yours code with preprocessor operators.
Better to solve problems with Appium instead of this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With