There’s no good solution for this as we can’t check for SDK versions at build time or dynamically check for symbols at runtime. What you can do is a build time check for the Swift version (#if swift(>=5.8)) around the checks for the new API. Technically it’s not a guarantee but Apple’s inflexibility with SDK versions in Xcode works in your favor here, so it should be stable.
#if swift(>=5.7.1)
if #available(iOS 16.0, *) {
var font = Font.system(.headline)
font = font.width(Font.Width.condensed)
}
#endif
but I also realized that I could specify // swift-tools-version: 5.7.1 as the minimum tools version and this is essentially forcing developers to use Xcode 14.1 with iOS SDK 16.1.
Your proposal has the charm that the Swift package generally allows lower swift tools version / Xcode versions but developers would not benefit from the code change (which might or might not be critical)