The talk describes a Default View displayed whenever running my intent (7:32).
I never see any view other than the Siri interaction at the bottom. Are there other requirements for getting the Default View to display?
I have experimented with adding a custom snippet view to the result:
func perform() async throws -> some IntentResult & ProvidesDialog & ShowsSnippetView {
...
return .result(
dialog: "\(response)",
view: IntentSnippetView(prompt)
)
That does display, but has way too much information. My IntentSnippetView only has a single Text("Hello World") but the view shows the entire contents of the response value as well. Is there any way to limit what actually shows up in the response snippet view?
Is there any way to get the described Default View to show while the intent is running?
The talk also suggests custom views can be shown at Intent Confirmation and Value Confirmation. In my case neither of those seem applicable since those confirmation steps are not used.
I'd really like to have at least the Default View, or be able to make the result view less overwhelming. I've looked through the documentation, but don't find much about custom widget views or intent views - any pointers would be appreciated!
Here's my code just in case its clear I'm doing something wrong:
import AppIntents
struct AskMyApp: AppIntent {
static var title: LocalizedStringResource = "Ask"
static var description: IntentDescription = IntentDescription("This will ask MyApp")
static var openAppWhenRun = false
@Parameter(title: "Prompt", description: "The prompt to send", requestValueDialog: IntentDialog("What would you like to ask?"))
var prompt: String
@MainActor
func perform() async throws -> some IntentResult & ProvidesDialog & ShowsSnippetView {
let response = ViewModel.shared.sendIntentPrompt(newPrompt: prompt)
return .result(
dialog: "\(response)",
view: AskMyAppSnippetView(prompt)
)
}
static var parameterSummary: some ParameterSummary {
Summary("Ask \(\.$prompt)")
}
}
import SwiftUI
struct AskMyAppSnippetView: View {
var body: some View {
Text("Hello World")
}
}