I’m making a library that uses the variants variable of AVAsset. That’s less important; the significant part is that it has an Xcode 13+ requirement. This library may be used by apps running Xcode 12. Is there a compiler flag that can run code only if on a certain version of Xcode?
Something like how you would do this for a Swift version:
#if swift(>=5.0)
// code
#else
// code
#endif
I’d want to do
#if xcode(>=13.0)
// use variants
#endif
3
Answers
I found that
#if compiler(>=5.5)
works here. Note, this is different thanif swift(>=5.5)
, which will not necessarily work depending on the swift version you have set in your project.From what I know, there’s no way of directly checking the Xcode version. However, Xcode 13 supports iOS 15, Xcode 12 doesn’t. You can use that as a workaround to check if Xcode version is 13 or higher.
Actual Post Link
And then here’s how to check:
All the best 😊