import AppIntents
struct AddTodoIntent: AppIntent {
static var title: LocalizedStringResource = "Add Todo"
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult & ProvidesDialog {
.result(dialog: "New todo added successfully.")
}
}
struct ViewTodosIntent:AppIntent {
static var title: LocalizedStringResource = "View Todos"
func perform() async throws -> some IntentResult & ProvidesDialog {
.result(dialog: "Here are your todos...")
}
}
struct TodoAppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: AddTodoIntent(),
phrases: ["\(.applicationName) Add a new todo"],
shortTitle: "New Todo",
systemImageName: "plus.circle"
)
AppShortcut(
intent: ViewTodosIntent(),
phrases: ["\(.applicationName) Show my todoso"],
shortTitle: "Show todos",
systemImageName: "plus.app"
)
}
} when we used, it wrong
How did i can do it success?