Implement App Shortcuts with App Intents

RSS for tag

Discuss the WWDC22 Session Implement App Shortcuts with App Intents

Posts under wwdc2022-10170 tag

2 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

AppIntent with long-running perform()
I'm using the AppIntents framework introduced in iOS 16. My goal is to create an AppIntent that performs a long-running task but does open my app when run. When I run the Intent from the Shortcuts app, I see an error message that says the shortcut "was interrupted because it didn't finish executing in time." Is there a way to signal progress to the user of a long-running AppIntent or get more time from the system prior to the AppIntent being cancelled?
3
1
2.1k
Jan ’25
Using Maps in App Intents
I want to use MapKit with App Intents, but the map does not show up.(See attached image) Can anyone help me solve this? import SwiftUI import MapKit struct ContentView: View {   @State private var region = MKCoordinateRegion(     center: CLLocationCoordinate2D(latitude: 37.334_900,                     longitude: -122.009_020),     latitudinalMeters: 750,     longitudinalMeters: 750   )       var body: some View {     VStack {       Map(coordinateRegion: $region).frame(width:300, height:300)         .disabled(true)     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } import AppIntents import SwiftUI import MapKit struct test20220727bAppIntentsExtension: AppIntent {   static var title: LocalizedStringResource = "test20220727bAppIntentsExtension"       func perform() async throws -> some IntentResult {     return .result(value: "aaa", view: ContentView())   } } struct testShortcuts:AppShortcutsProvider{   @available(iOS 16.0, *)   static var appShortcuts: [AppShortcut]{     AppShortcut(       intent: test20220727bAppIntentsExtension(),       phrases: ["test20220727bAppIntentsExtension" ]     )   } }
2
0
1.2k
2w