How to use TCA and WKInterfaceObjectRepresentable on watchOS

I dont know how to use TCA in combination with a WKInterfaceObjectRepresentable. In my case I have something like that:

struct WatchMapView: WKInterfaceObjectRepresentable {
    var viewStore: ViewStore<MapState, MapAction>

    init(store: Store<MapState, MapAction>) {
        self.viewStore = ViewStore(store)
    }

    func updateWKInterfaceObject(_ wkInterfaceObject: WKInterfaceMap, context: WKInterfaceObjectRepresentableContext<WatchMapView>) {
        wkInterfaceObject.setRegion(self.viewStore.mapRegion)
    }

    func makeWKInterfaceObject(context: WKInterfaceObjectRepresentableContext<WatchMapView>) -> WKInterfaceMap {
        return WKInterfaceMap()
    }
}

The state only has a mapRegion, wich gets updated over a WCSession. The states changes like it should, but the View dose not update. Only when I go back to the main menu and navigate to the map again, the updates are shown.

struct MapState: Equatable {
    var mapRegion: MKCoordinateRegion
}

Does anyone know whats wrong with my code/understanding?

Terms of Service

Privacy Policy

Cookie Policy