I created an intent for a configurable widget that lets users choose an option for a parameter called "domain."
I've successfully loaded the selectable items for this parameter using the following code:
import Intents
class IntentHandler: INExtension, ConfigChartIntentHandling {
func provideDomainOptionsCollection(for intent: ConfigChartIntent) async throws -> INObjectCollection<Domain> {
let prefs = UserDefaults(suiteName: "group.name")
let domains = prefs?.stringArray(forKey: "domains")
if let domains {
let optionsCollection = domains.map { Domain(identifier: $0, display: $0) }
return INObjectCollection(items: optionsCollection)
} else {
// If no options, provide an empty list or a default option
return INObjectCollection(items: [])
}
}
}
The issue occurs when I select a value for the "domain" parameter. Each time I select a value and then reopen the configuration modal, the field reverts back to "Choose." Here's a screenshot illustrating the behavior:
Additionally, the widget doesn’t refresh after I change the "domain" value. However, another parameter using an enum ("Stats Type") works as expected.
Is there something I might be missing?
My Environment:
MacOS Sonoma
XCode 15.4