SwiftUI Previews + Device Sync: Make It Less Painful? #8528
Labels
Importance:Major
O-Community
SDK-Use:Sync
T-Enhancement
Waiting-For-Reporter
Waiting for more information from the reporter before we can proceed
Problem
I have an app that uses Realm and Atlas Device Sync. If I add a SwiftUI view and allow Xcode to show me a preview of it, Xcode has to invisibly build and run the entire app (regardless of whether anything in the SwiftUI view depends on anything else in the app).
The trouble is that the next time I hit the "play" button in Xcode to actually build and run the app, it immediately crashes with a "multiple sync clients connected" exception. Because the SwiftUI preview version is still running.
Closing the preview canvas or switching away from it by selecting a different file does not solve the issue. The only reliable solution is to quit and relaunch Xcode. This is painful.
Apple is unlikely to ever solve this. They don't care about people using Realm. Is there anything that can be done from Realm's side to make SwiftUI previews more friendly?
Solution
The ideal solution is that a true build-and-run of the app (from the user clicking the play button in Xcode) "overrides" any other running version of the binary from the SwiftUI preview. Functionally, I imagine that's difficult.
Alternatives
No response
How important is this improvement for you?
Would be a major improvement
Feature would mainly be used with
Atlas Device Sync
The text was updated successfully, but these errors were encountered: