Reference that in HostingController. Note that we need to change from generic MainView to WKHostingController<AnyView> as environmentObject returns View protocol
1 2 3 4 5 6 7 8 9 10 11 12 13 14
classHostingController: WKHostingController<AnyView> { var storeContainer: StoreContainer!
In theory, the environment object will be propagated down the view hierarchy, but in practice it throws error. So a workaround now is to just pass that environment object down manually
Fatal error: No ObservableObject of type SomeType found A View.environmentObject(_:) for StoreContainer.Type may be missing as an ancestor of this view