When the perform method of my AppIntent returns the custom view's dialog, and after I click the "Click Test" button, my app will be launched, but this dialog does not close. How can I close it?
struct QuestionResultView: View {
var body: some View {
VStack {
if #available(iOS 17.0, *) {
Button(role:.cancel, intent: OpenAppIntent()) {
Text("Click Test")
}
}
}.frame(height: 300)
}
}
struct OpenAppIntent : AppIntent {
static let title: LocalizedStringResource = "Open my app"
static let openAppWhenRun: Bool = true
static let isDiscoverable: Bool = false;
@MainActor
func perform() async throws -> some IntentResult {
return .result()
}
}
struct OpenPhotoRecognizing: AppIntent {
static let title: LocalizedStringResource = "Read photo"
static let description = IntentDescription("")
static let openAppWhenRun: Bool = false
func perform() async throws -> some IntentResult & ShowsSnippetView & ProvidesDialog{
return .result(dialog: "Demo Test") {
DemoResultView()
}
}
}