Post

Replies

Boosts

Views

Activity

How remove AppIntent dialog programmatically?
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() } } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
53
May ’25
AppIntent complie issue & manual remove AppIntent dialog
1.When I attempted to open the subsequent AppIntent within the perform method of the AppIntent instance, I always received the following error: How to solve the problems of inconsistency of this type? I couldn't find any sample code. 2.When I used method 'Button(intent: OpenAppIntent())' to open my app through the dialog custom view of AppIntent, but I couldn't find a way to close this AppIntent dialog. How can i remove this dialog?
Topic: UI Frameworks SubTopic: General
2
0
57
May ’25