Hi, I have developed an iOs app (16+) with SwiftUI. Now I am adding the ability to use voice commands with Siri by creating App Intents. I would like to give users the ability to be able to say, "Siri records 2 hours and 30 for client Mark."
For the time part I was thinking of using the @Parameter with data type "Duration" but I get error back and maybe it is not the right type since it accepts seconds as input. What do you recommend?
Thanks
import Foundation
import AppIntents
import UIKit
struct AddExpense: AppIntent {
static var title: LocalizedStringResource = "Record"
@Parameter(title: "Customer")
var dossier: String
@Parameter(title: "Time")
var tempo: Duration
func perform() async throws -> some IntentResult & ProvidesDialog {
//await addExpense()
let dialog = IntentDialog("Ok!")
return .result(dialog: dialog)
}
}
Error: Generic class 'IntentParameter' requires that 'Duration' conform to '_IntentValue'
Warning: Stored property '_tempo' of 'Sendable'-conforming struct 'AddExpense' has non-sendable type '<>'
Documentation [https://developer.apple.com/documentation/appintents/providing-your-app-s-capabilities-to-system-services]