Does anyone know why #swift 6 erases `some View` to `AnyView`?
At first I thought that ViewBuilder messes something up (e.g. due to the availability restrictions - even though those are the ones of #SwiftUI itself). But since the extra `_body` property has the same problem, it seems to me that this is #swift related.
@ffried if Xcode thinks you’re building with previews enabled, it’ll implicitly wrap views in AnyView in order to facilitate dynamic reloading of the preview. That might be one reason
@joe Good point. Is there a way to disable this for Swift Packages, though?
@ffried at some point debug builds had the “make everything dynamically replaceable” enabled but release builds didn’t, not sure if there are other factors these days. I’ll ask around
@joe Very much appreciated, thanks!
@ffried Yeah, previews and debug builds now share build products, so views in debug builds get the AnyView wrapping. You can set SWIFT_ENABLE_OPAQUE_TYPE_ERASURE=NO in the build settings to disable this separately (though this probably breaks previews, so you might want to set up a separate scheme if you use previews)
@joe Awesome, thanks for looking into it!
Now I just need to figure out how to set that build setting for test builds only somehow.