Open lawrence-forooghian opened 2 years ago
I started working on this on branch 403-fix-swiftui-previews-in-publisher-example
, but hit the limits of my SwiftUI experience (which is pretty much none). I started turning the view models and location manager into protocols, but I don't really know whether this is the way people usually approach this problem in SwiftUI, and I was also a bit confused about ownership and when the view models should be instantiated. Also, I didn't know whether it would be a problem that you can't use @Published
in a protocol, which hence meant we couldn’t get bindings to any of the view model’s properties.
We might end up naturally returning to this one as part of the example app feature work.
The corresponding Jira issue is https://ably.atlassian.net/browse/SDK-2703
Currently, the Xcode view previews use the real
LocationManager
(and hence actually use Core Location), the settings view preview uses user defaults, and the map view uses a real publisher.It would be good if we could instead use mock objects here so that we can generate view previews for different states.