Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Siri Intent Dialog with custom SwiftUIView not responding to buttons with intent

I have created an AppIntent and added it to shortcuts to be able to read by Siri. When I say the phrase, the Siri intent dialog appears just fine. I have added a custom SwiftUI View inside Siri dialog box with 2 buttons with intents. The callback or handling of those buttons is not working when initiated via Siri. It works fine when I initiate it in shortcuts. I tried using the UIButton without the intent action as well but it did not work. Here is the code.

    static let title: LocalizedStringResource = "My Custom Intent"
    static var openAppWhenRun: Bool = false

    @MainActor
    func perform() async throws -> some ShowsSnippetView & ProvidesDialog {
        return .result(dialog: "Here are the details of your order"), content: {
    OrderDetailsView()
    }
}

struct OrderDetailsView {
    var body: some View {
        HStack {
            if #available(iOS 17.0, *) {
                Button(intent: ModifyOrderIntent(), label : { 
                    Text("Modify Order")
                })
                Button(intent: CancelOrderIntent(), label : {
                    Text("Cancel Order")
                })
            }
        }
    }
}

struct ModifyOrderIntent: AppIntent {
static let title: LocalizedStringResource = "Modify Order"
    static var openAppWhenRun: Bool = true

    @MainActor
    func perform() async throws -> some OpensIntent {
        // performs the deeplinking to app to a certain page to modify the order
    }
}

struct CancelOrderIntent: AppIntent {
    static let title: LocalizedStringResource = "Cancel Order"
    static var openAppWhenRun: Bool = true

    @MainActor
    func perform() async throws -> some OpensIntent {
        // performs the deeplinking to app to a certain page to cancel the order
    }
}


Button(action: {
     if let url = URL(string: "myap://open-order") {
          UIApplication.shared.open(url)
     }
}

Siri Intent Dialog with custom SwiftUIView not responding to buttons with intent
 
 
Q