I once posted a question in the forums, but it seems I cannot find the thread now (maybe the thread was before the new forums was born).
I don't know why I am so confused about this directive (or whatever):
- It looks like a compiler directive because it has a specific syntax.
- But it also looks like it's a runtime check because it is used in if statement (not in #if).
So my question is: Given the following code:
if (@available(macOS 13.0, *) {
NSLog("Running on macOS Ventura or later")
} else {
NSLog("Running on older version before Ventura")
}
Does this directive check real macOS version during runtime?
@available(macOS 13.0, *) is a compile time, restrictions depending on the minimum version.
Get details here: https://forums.swift.org/t/if-vs-available-vs-if-available/40266