Implement App Shortcuts with App Intents

RSS for tag

Discuss the WWDC22 Session Implement App Shortcuts with App Intents

Posts under wwdc2022-10170 tag

8 Posts
Sort by:
Post not yet marked as solved
0 Replies
46 Views
I am trying to create a shortcut following "Implement App Shortcuts With App Intents" talk from WWDC2022. The below is my MWE. In a standalone app, this can be extended and behave like the video. Adding this code to my main app, makes the shortcut show up within the Shortcuts app, but if I click on it, it pops up an alert saying Error Domain=LNActionForAutoShortcutPhraseFetchError Code=1 "Couldn't find AppShortcutsProvider" UserInfo={NSLocalizedDescription=Couldn't find AppShortcutsProvider} My main app has several targets, so I suppose I need to establish which one is the shortcuts provider, but I cannot find any reference to how to do this in the documents. Via Siri, the shortcut command is not recognised at all. import AppIntents import SwiftUI struct DoSomething: AppIntent {  static var title: LocalizedStringResource = "Do something"  func perform() async throws -> some IntentResult {   return .result()  }  static var openAppWhenRun: Bool = false } struct MyShortcuts: AppShortcutsProvider {  @AppShortcutsBuilder  static var appShortcuts: [AppShortcut] {   AppShortcut(    intent: DoSomething(),    phrases: ["Do Something in \(.applicationName)"],    systemImageName: "books.vertical.fill"   )  } }
Posted
by esroberts.
Last updated
.
Post not yet marked as solved
0 Replies
43 Views
Hello, I am creating a shortcut to ask me at a specific time on certain days, am I working from home tomorrow. If I answer with yes, turn on my 8AM alarm, otherwise, if no, turn on my 7AM alarm. I am almost there with choosing a list and if then function but cannot seem to figure out why the rest will not work. Thoughts?
Posted Last updated
.
Post not yet marked as solved
1 Replies
96 Views
Is it possible to put a pause in Siri's responses to an AppIntent? in the code below id like Siri to pause a bit longer than she does between sentence one and sentence two. i've tried using "..." and multiple "." similar to what she does when she's responding to "how is the market" if you ask a HomePod - she pauses a bit longer between her comments on each market, a bit more than an end of sentence - more like the pause between each point when you are going through a list of bullet points - which is really what i'm using this for. Also is it possible to hide all or part of of the dialog text displayed? so she says it but doesn't show it. I've got a view which shows a better formatted representation of what she says than the text itself. struct TestAppIntent: AppIntent {     static var title: LocalizedStringResource = "A question?"     static var openAppWhenRun: Bool = false     @MainActor     func perform() async throws -> some IntentResult {         return .result(             dialog: "sentence one. sentence two", view: someView()         )     } }
Posted
by ngb.
Last updated
.
Post marked as solved
2 Replies
383 Views
Hi, We are trying to add our application shortcuts using below code but it's not getting reflected in Shortcuts App and so Siri feature is not working for our app. We followed the same approach mentioned in WWDC 2022 session. Kindly suggest the fix. struct StartMeditationIntent: AppIntent {     static let title: LocalizedStringResource = "Start Meditation Session"     func perform() async throws -> some IntentPerformResult {         let answer: LocalizedStringResource = "Session Started"         let dialogIntent  = IntentDialog(answer)         return .finished(dialog: dialogIntent)     } } struct LibraryAutoShortCuts: AppShortcutsProvider {     static var appShortcuts: [AppShortcut] {         AppShortcut(intent: StartMeditationIntent(), phrases: ["Start Meditation"])     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
97 Views
Hello, If application has Siri Shortcuts which are configurable inside Shortcuts app and if make app intents for that Siri Shortcuts, it shows duplicate entries while searching for application and available shortcuts. Any way to avoid this? Thanks Hiren
Posted Last updated
.
Post not yet marked as solved
2 Replies
395 Views
I'm trying to test out the new AppIntents API that is currently on iOS16 Beta. Looking at the documentation, the implementation seems pretty straight forward, but after implementing it, I'm not seeing my AppIntent in the Shortcuts app. The device is running iOS 16.0. This is how I implemented the AppIntent: import AppIntents struct DoSomethingIntent: AppIntent { static var title: LocalizedStringResource = "This will do something" static var description = IntentDescription("Does something") func perform() async throws -> some PerformResult { return .finished(value: "Done") } } According to the documentation the Shortcuts app should be able to find my AppIntent after my app gets installed, but I see that's not the case. Does anybody know what my implementation is missing or have I misunderstood the whole thing?
Posted
by Norik.
Last updated
.
Post not yet marked as solved
0 Replies
156 Views
In the video the app entity type is called MeditationSession (10:09) but in the StartMeditationIntent the @Parameter's type is SessionType (11:16). Maybe it is a different type but from what I understand it should be the same since the disambiguation is done among SessionManager.allSessions which returns an array of MeditationSessions and the type of sessionToRun needs to match self.session.
Posted Last updated
.