The if #available(macOS 26, *) { … } checks required to call newer APIs from apps that still run on older OSes are really cumbersome to use in SwiftUI.
This technique from @davedelong makes this much nicer and easier: https://davedelong.com/blog/2021/10/09/simplifying-backwards-compatibility-in-swift/
You might still have to do some manual mapping of enums and constants, but that ugliness is contained, leaving your call sites clean.
Simplifying Backwards Compatibility in Swift
Every year as new OS and Swift versions are released, the question comes up over and over again: “how do I use this new thing while also supporting older versions?”. While we have a bunch of “availability” tools at our disposal (and I’ll be using them in this post), they always come across as somewhat cumbersome: we need to do inline checks, or we have conditional logic flow that obfuscates the intent of some of our code, and so on.