Package, SwiftUI, ≤ iOS 10

Has anyone found a workaround to use SwiftUI guarded with @available in a package that has a deployment target ≤ iOS 10? (The default is iOS 8.)

@available works fine for the other platforms, and works if the deployment target is > iOS 10, but with ≤ iOS 10, you get “Use of undeclared type” errors.

Do you have an example of a package which fails in this manner?

Yes. But it is a live package, so the new SwiftUI stuff is disabled on iOS right now so that the rest of it works. I’ll create a branch with it set up better and report back.

I ended up making a minimal package instead. The demonstration is here.

1 Like

Thank you for the example! The failure occurs because builds with a deployment target earlier than iOS 11 will also build for the armv7 architecture, and there is no armv7 swiftmodule for SwiftUI in the iOS SDK because the OS version in which it was first introduced (iOS 13) does not support armv7 anymore. As a workaround, you can wrap any code which uses SwiftUI APIs in #if !arch(arm).

Can you please also file an issue using Feedback Assistant which we can use to track this?

2 Likes

Woohoo! I knew someone out there would be able to figure out a way.

I’ll get right on that.

1 Like

Feedback Assistant identifier: FB7431741

(I was really tempted to fill it out in German to match the interface Feedback Assistant presented to me. Out of curiosity, what would have happened on your end had I done that?)

1 Like
Terms of Service

Privacy Policy

Cookie Policy