When using new, non-critical #SwiftUI features while still targeting old OS versions, I like to use a "prefers" view extensions that express intent but only apply a modifier if it's available.
I write a bit about it here:
https://danielsaidi.com/blog/2023/06/15/swiftui-prefers-semantics
@danielsaidi Nice idea. I would probably pass through the .hidden parameter as well rather than make that part of the naming.
@matadan Thanks! :) I would too, if my open-source library had target iOS 15...bu it unfortunately targets iOS 14.
@danielsaidi Ah yes. You’d have to make a proxy value that wraps the parameter type to abstract it away from the OS version.
@danielsaidi I make similar modifiers but rename with “ifAvailable” on the end like .menuOrderIfAvailable(.fixed)