Linked Questions

Popular Questions

Siri Watch Face and `RelevantIntentManager`

Asked by At

I am trying to add a watch widget that I've created for Smart Stack feature of watchOS 10 to also appear in the list of shortcuts shown in the Siri Watch Face. It seems like Apple now wants us to use RelevantIntentManager for this purpose, but my widget never shows up in the Siri Watch face. This is the code that I am using.

    func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline<GenericEntry> {
        await updateRelevantIntents()
        return timeline
   func updateRelevantIntents() async {
        var relevantIntents = [RelevantIntent]()
        let defaults = UserDefaults.init(suiteName: "")!
        guard let name2VIN = defaults.dictionary(forKey: Constants.VEHICLE_NAME_VIN_DICT) as? [String:String] else {
        let carNames = Array(name2VIN.keys)
        for (idx, name) in carNames.enumerated() {
            let intent = ConfigurationAppIntent()
            intent.order = idx
            intent.carName = name
            intent.action = nil
            let txt = "\(name): info only"
            let relIntent = RelevantIntent(intent, widgetKind: "WatchWidget", relevance: .now, to: .now + 3600 * 1))
        do {
            try await RelevantIntentManager.shared.updateRelevantIntents(relevantIntents)
        } catch (let error) {
            print("\(#function): \(error.localizedDescription)")

Related Questions