How to Remove OpaqueTypeErasure from SwiftUI

I am using swiftui lately in my iOS mobile app, The Mobile app already has a pipeline that detect any experimental features and throw an error

I am using swift 5 and as you all know SwiftUI is using some of OpaqueTypeErasure utility types like "some"

I heard that in swift 6 the OpaqueTypeErasure is not experimental anymore

But upgrading the app swift version will be a very long process

Also changing the pipeline will be a very long and tiring process

So i want to know if there is a way to remove OpaqueTypeErasure from SwiftUI and what is the alternatives for bypassing the error that being thrown from the pipeline

Just branch and prepare your code base for Swift 6 instead of setting up the project for obsolescence.

I’m not exactly sure what your concern is here, so lets start with something simple: Are you building your app with Xcode 16 already?

If so, be aware that you’re already using the Swift 6 compiler version. You can switch between language modes via the Swift Language Version build setting, but you always get the Swift 6 compiler [1].

The main difference between the Swift 5 and 6 language modes is the data race safety enforcement. If you’re not prepared to tackle that, it’s fine to stay on the Swift 5 language mode.

AFAIK the language mode doesn’t affect generics, like some and any. If you have a specific case that’s a concern, please post back with the details and I’ll take a look.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] And yes, this stuff is confusing, and there’s an active effort to improve how we talk about this stuff. See SE-0441 Formalize ‘language mode’ terminology.

It’s better if you reply, rather than in the comments. See Quinn’s Top Ten DevForums Tips for this and other titbits.

I didn't gte you ?

Sorry about that.

Honestly, I’m not sure what your concern is here. You original post mentions OpaqueTypeErasure but that’s not a symbol in any of Apple’s SDKs. And searching the ’net for "OpaqueTypeErasure" only turns up one hit, this thread.

If you can explain your concern in more detail, I’d be happy to help out further.

But upgrading the app swift version will be a very long process

That shouldn’t be the case if you stick with the Swift 5 language mode. In general, the Swift 6 compiler in Xcode 16 is very compatible with the Swift 5 compiler in older versions of Xcode as long as you don’t enable the Swift 6 language mode.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to Remove OpaqueTypeErasure from SwiftUI
 
 
Q