Using SwiftUI APIs introduced in iOS minor releases

I have a Swift package that uses SwiftUI.Font.width that was introduced in iOS 16.1 (and not like the documentation suggests in iOS 16.0)

Using this function in Xcode 14.0 (iOS 16.0) results in a compilation error.

I tried using a conditional compilation statement but I still receive a compilation error in Xcode 14.0.

if #available(iOS 16.1, *) {
  var font = Font.system(.headline)
  font = font.width(Font.Width.condensed)
} 

My Swift package has minimum swift-tools-version of 5.5. and even changing to 5.7 would mean that developers could use Xcode 14 theoretically 😦

Any suggestions?

What's the error you're seeing?

I recommend updating to Xcode 14.2 or later, so you're using the latest version of the iOS SDK. Font.Width was first made available in the iOS 16.1 SDK, but can be deployed on devices running iOS 16.0. You may be using a version of the iOS 16 SDK which originally annotated the availability as iOS 16.1.

Using SwiftUI APIs introduced in iOS minor releases
 
 
Q