Rightpoint / ViewState

Small library for lightweight UIView and UIViewController state management on iOS
MIT License
12 stars 0 forks source link

"Use of undeclared type 'UIViewRepresentable'" when archiving for Release #2

Open chrisballinger opened 4 years ago

chrisballinger commented 4 years ago

It seems that when archiving a release build, the SwiftUI imports are no longer available when integrated via SPM.

mattwhitlock commented 3 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.

chrisballinger commented 3 years ago

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.

mattwhitlock commented 3 years ago

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.

chrisballinger commented 3 years ago

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.

mattwhitlock commented 3 years ago

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.