Open chrisballinger opened 4 years ago
It's not as simple as a compiler flag disable of the the UIViewRepresentable stuff is it? I can see how that would be optimized out for release, but not sure why it's not smart enough to discard that stuff though.
I think the bridging between ViewState and SwiftUI is important to keep even in Release builds, because the utility extends beyond Xcode Previews. It means that you can much more easily mix and match a ViewState-compatible UIView/UIViewController with your SwiftUI views.
OK, The error must be in a different place than I was thinking then. It sounded like it was only with the UIViewControllerRepresentable / UIViewRepresentable parts.
The error is definitely with the UIViewControllerRepresentable / UIViewRepresentable parts, I'd just like to fix the problem at the core and allow it to work for both Debug and Release.
I understand the issue now, thanks for the clarification. We're not just doing it for previews, obviously. If protocol extension is not allowed and the doc indicates that we need to use a Coordinator
, it's a bit more work. Sorry for taking a cursory view of the issue.
It seems that when archiving a release build, the SwiftUI imports are no longer available when integrated via SPM.