How to translate the following code snippet from Swift to Objective-C?
How to translate the following code snippet from Swift to Objective-C?
#if compiler(>=5.5)
if #available(iOS 15.0, *) {
myTableView.sectionHeaderTopPadding = 0.0
}
#endif
Alternatively, is there any macro in objective c side that assists to know the compiler version?
UPDATE:
@Cy-4AH suggested and answer that used,
#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
...
}
#endif
However, in my case #ifdef __IPHONE_15_0
is not available in Xcode12.x
I have managed to solve this problem with a workaround discussed here.
#if __clang_major__ >= 12
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 12.x can support.");
#endif
Note that clang_major or clang_minor etc. variables resemble (almost same to) Xcode versions and need careful investigation before the usage.