I am trying to use environmentObject in a watchOS6 app to bind my data model to my view.
environmentObject
I have created a simple, stand-alone Watch app in Xcode 11.
You can use type erasure, AnyView in the case of SwiftUI View.
AnyView
View
I would refactor WKHostingController to return AnyView.
WKHostingController
This seems to compile fine on my end.
class HostingController : WKHostingController { override var body: AnyView { return AnyView(ContentView().environmentObject(DataModel())) } }