Error building for device while supporting older iOS versions

Hi folks!

We (Firebase) ran into an issue when introducing a new SwiftUI specific API into our Swift package that supports iOS 10+. We've marked the API appropriately with #if canImport(SwiftUI) as well as @available checks, and building for simulator works but building for device fails with an error of Cannot find type 'View' in scope.

Changing the minimum supported version from v10 to v11 resolves the issue, leading me to believe it could have to do something with attempting to link for armv7, but that's just a hunch.

I've created a simplified repro here with instructions: GitHub - ryanwilson/Repro-SwiftPMMinVersionBuild: A simplified repro showing building and archiving iOS apps with older iOS versions to solve https://github.com/firebase/firebase-ios-sdk/issues/7785

Any ideas for workarounds, or is this just an Xcode bug that should be filed as such?

Thanks!

2 Likes