Data sharing between WidgetWatchExtension and watchOS/iOS app

When I try to access the data in my IntentTimelineProvider in the recommendations function using App Groups, it is always empty "no data".

func recommendations() -> [IntentRecommendation<IndicatorIntent>] {
        if let sharedUD = UserDefaults(suiteName: "group.measurements") {
            let jm = JanitzaMeasurementValue(identifier: "1", display: "2")
            let intent = IndicatorIntent()
            intent.indicatorWidgetData = jm
            let desc = sharedUD.string(forKey: "string") ?? "no data"
            return [IntentRecommendation(intent: intent, description: desc)]
        }
        
        return []
    }

Although I write this in both the watchOS and iOS app using App Groups.

if let sharedUD = UserDefaults(suiteName: "group.measurements") {
     sharedUD.set("test", forKey: "string")
}

What is the right way to dynamically implement the widgets for Complications in watchOS? Like for example in Shortcuts App.

**Thanks for support **

Data sharing between WidgetWatchExtension and watchOS/iOS app
 
 
Q