Objective-C has an @available expression in XCode 9+ / LLVM 5+ that allows you to guard a block of code to at least a certain OS version so that it won\'t emit unguarded ava
The way I came up with that seems to change the layout of the code the least is:
do {
if (@available(iOS 11.0, *)) {
if (some_condition) {
// code to run when on iOS 11+ and some_condition is true
break;
}
}
// code to run when on older iOS or some_condition is false
} while (0);
which is still ugly.