I am almost new to coding and I need to make an app that uses AppIntents. I would like that the intent used an array of elements to change a Text. Lets say that the array is an array of strings: ["Mountain", "Car", "Ball"] If I tell Siri: "Hey Siri, set the text to Ball" the intent should change the text to "Ball". If I tell Siri: "Hey Siri, set the text to "Mountain" the intent should change the to "Mountain"
struct chooseWord: AppIntent {
@Parameter(title: "Word")
var word: String
static var title: LocalizedStringResource = "Change the text"
static var description = IntentDescription("Changes the text on screen")
static var openAppWhenRun: Bool = true
static var parameterSummary: some ParameterSummary {
Summary("Changes the word to ...")
}
@MainActor
func perform() async throws -> some IntentResult {
return .result(dialog: "Done!")
}
}
This is the basic Intent code. Hope you can help me. Sorry if I misspelled something or I use bad grammar, English is not my first language. Thanks