rdwampler
(Ronald Wampler)
1
For instance why can't I write:
aVisualEffectView.material = #available(OSX 10.14, *) ? .light : .toolTip
Is there a technical reason or style issue with the above?
2 Likes
Joe_Groff
(Joe Groff)
2
#available is a "statement condition", meaning it's used in if, guard, and while statements because it affects the scope of the following body where the condition is true. This is like the if let x = optional or if case <pattern> = <value> syntax, which also don't currently work in ternaries. We could conceivably make it so that these conditions work in ternaries as well, and have the expect effect on the scope of the "true" arm of the ternary, but just haven't implemented this yet.
2 Likes
rdwampler
(Ronald Wampler)
3
Thanks. Would such a change need a proposal?