0
  1. I want to say something in one shot like: "Start my intent that does command xyz"
  2. It currently breaks it down into 2 separate steps, where I have to specify "Start my intent" first then tell the command.

How can I do that in one shot?

struct MyIntent: AppIntent {
    static var title = LocalizedStringResource("Start My Intent")
    static var openAppWhenRun: Bool = true
    static var description = IntentDescription(
        "Start my intent"
    )
    @Parameter(title: "My Intent Command", description: "Say anything you want to ask") var context: String

@MainActor
func perform() async throws -> some IntentResult & ReturnsValue<String> {
    UserDefaults.standard.set(context, forKey: "my.intent.command")
    AppBridge.processIntent(with: context)
    
    return .result(value: "\(context)")
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.