import AppIntents
struct MGIntents: AppIntent {
static var title = LocalizedStringResource("open app")
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult & ProvidesDialog {
return .result(dialog: "app open")
}
}
struct AppItentsShortcuts:AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(intent: MGIntents(),
phrases: ["\(.applicationName) Open app"],
shortTitle: "Open app",
systemImageName: "fan.desk.fill")
}
}
when use ,error more error。
when i delet openAppWhenRun ,is ok。why?
how I can do it? thank you!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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?