Share intents from within an app to drive system intelligence and show the app's actions in the Shortcuts app.

Posts under Intents tag

56 Posts
Sort by:
Post not yet marked as solved
2 Replies
741 Views
I have an app that relies heavily on AppIntents and Shortcuts and it seems like the latest iOS update broke those but I can't quite figure out what's the issue. The is that no matter what parameter I pick, when running the shortcut it always uses the defaultResult() Here's an example AppEntity: struct IntentBrokerAppEntity: AppEntity { static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Intent Broker") @Property(title: "Name") var name: String? @Property(title: "Ip") var ip: String? @Property(title: "Port") var port: String? @Property(title: "Username") var username: String? @Property(title: "Password") var password: String? @Property(title: "Tls") var tls: Bool? struct IntentBrokerAppEntityQuery: EntityQuery { func entities(for identifiers: [IntentBrokerAppEntity.ID]) async throws -> [IntentBrokerAppEntity] { return try await suggestedEntities().filter { identifiers.contains($0.id) } } func suggestedEntities() async throws -> [IntentBrokerAppEntity] { let context = PersistenceController.shared.viewContext let brokerService = BrokerService(context: context) return brokerService.getFavorites().map { IntentBrokerAppEntity(broker: $0) } } func defaultResult() async -> IntentBrokerAppEntity? { try? await suggestedEntities().first } } static var defaultQuery = IntentBrokerAppEntityQuery() var id: String // if your identifier is not a String, conform the entity to EntityIdentifierConvertible. var displayString: String var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(displayString)") } ... This used to work perfectly fine before 17.2, but now instead of choosing the entity the user picked it always falls back to defaultEntity(). In the console I get this warning Failed to build EntityIdentifier. IntentBrokerAppEntity is not a registered AppEntity identifier But I'm not sure if that's related. Does anyone have any ideas on what's going on here? Input much appreciated!
Posted Last updated
.
Post not yet marked as solved
0 Replies
609 Views
I'm writing an application with App Shortcuts support. My task is to write a command that will check whether a certain application is open and runs the command. For example: The user installed a command through my application that responds to the Instagram application The user goes to Instagram My team is starting Question: Is it possible to organize this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
381 Views
I've created a barebones Multiplatform app and added an App Intent and App Shortcut. When running on iOS, I can see my app show up in Shortcuts and use the intent or App Shortcut as normal. On macOS, my app does not appear in the Shortcuts app, neither the App Shortcut nor the intent. Is there additional configuration required to enable Shortcuts / App Intents on macOS? This is the only code I've added to a brand-new Xcode Multiplatform project: import AppIntents struct OpenIntent: AppIntent { static let title: LocalizedStringResource = "Open MacShortcut" static let description: LocalizedStringResource = "Opens the app" /// Launch your app when the system triggers this intent. static let openAppWhenRun: Bool = true /// Define the method that the system calls when it triggers this event. @MainActor func perform() async throws -> some IntentResult { /// Return an empty result since we're opening the app return .result() } } struct MacShortcutShortcutsProvider: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: OpenIntent(), phrases: [ "Open a session of \(.applicationName)" ], shortTitle: "Open", systemImageName: "arrow.up.circle.fill" ) } }
Posted
by Ethan_.
Last updated
.
Post not yet marked as solved
1 Replies
462 Views
See the image attached. What are the APIs needed to add an action here that shows up across the system. Not a share extension, but the list of actions that are below that. How did Pinterest add theirs here? And it shows up for almost everything you share. I've been looking around and the only thing that looked like maybe is UIActivity. But when I implemented it doesn't show up across other apps. I was also lookin through app shortcut and app intent documentation but I can't find exactly how Pinterest is providing this action here.
Posted
by gngrwzrd.
Last updated
.
Post not yet marked as solved
0 Replies
385 Views
I want to "pause" an Intent ( iOS Shortcut Automation ) how can I achieve it? Basically we have a small task to execute, whenever we setup an automation for one app, lets say LinkedIn, our app runs and asks the user whether they still want to continue with LinkedIn or whether they don't want to. The automation to open our app when LinkedIn is opened is working fine. What we want to achieve is that once a user taps on "Continue to LinkedIn" it should "pause" the automation this time and open LinkedIn instead of opening our app again.
Posted
by Dropouts.
Last updated
.
Post not yet marked as solved
3 Replies
768 Views
I am trying to create a simple app that "blocks" other apps if a certain condition is not met. I am currently using the IOS shortcuts and have set up an automation that opens my app A whenever another app B opens. If the condition is not met i imagine the flow to look like: Open app A. My app B opens instead. I check a box in my app B. I navigate back to app A and it works as expected. If the condition already is met the app A would work as expected from the beginning. What is have tried so far My first attempt involved using an AppIntent and changing the openAppWhenRun programmatically based on the condition. I did however learn pretty quickly that changing the value of openAppWhenRun does not change if the AppIntent actually opens my app. The code for this looked like this where the value of openAppWhenRun is changed in another function. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blocks an app until condition is met" static var openAppWhenRun: Bool = false @MainActor func perform() async throws -> some IntentResult { return .result() } } Another attempt involved setting openAppWhenRun to false in an outer AppIntent and opening another inner AppIntent if the condition is met. If the condition in my app is met openAppWhenRun is set to true and instead of opening the inner AppIntent an Error is thrown. This functions as expected but there is an error notification showing every time I open the "blocked" app. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blocks an app until condition is met" static var openAppWhenRun: Bool = false func perform() async throws -> some IntentResult & OpensIntent { if (BlockerIntent.openAppWhenRun) { throw Error.notFound } return .result(opensIntent: OpenBlockerApp()) } enum Error: Swift.Error, CustomLocalizedStringResourceConvertible { case notFound var localizedStringResource: LocalizedStringResource { switch self { case .notFound: return "Ignore this message" } } } } struct OpenBlockerApp: AppIntent { static let title: LocalizedStringResource = "Open Blocker App" static let description: LocalizedStringResource = "Opens Blocker App" static var openAppWhenRun: Bool = true @MainActor func perform() async throws -> some IntentResult { return .result() } } My third attempt look similar to the previous one but instead I used two different inner AppIntents. The only difference between the two were that on had openAppWhenRun = false and the other had openAppWhenRun = true. struct BlockerIntent: AppIntent { static let title: LocalizedStringResource = "Blocker App" static let description: LocalizedStringResource = "Blacks an app until condition is met" static var openAppWhenRun: Bool = false func perform() async throws -> some IntentResult & OpensIntent { if (BlockerIntent.openAppWhenRun) { return .result(opensIntent: DoNotOpenBlockerApp()) } else { return .result(opensIntent: OpenBlockerApp()) } } } Trying this gives me this error: Function declares an opaque return type 'some IntentResult & OpensIntent', but the return statements in its body do not have matching underlying types I have also tried opening the app with a URL link with little to no success often ending up in an infinity loop, I did try the ForegroundContinuableIntent but it did not function as expected since it relies on the users input. Is there any way to do what I am trying to accomplish? I have seen other apps using a similar concept so I feel like this should be possible. Many thanks!
Posted
by EliasDev.
Last updated
.
Post not yet marked as solved
0 Replies
347 Views
When I add AppEnity to my model, I receive this error that is still repeated for each attribute in the model. The models are already marked for Widget Extension in Target Membership. I have already cleaned and restarted, nothing works. Will anyone know what I'm doing wrong? Unable to find matching source file for path "@_swiftmacro_21HabitWidgetsExtension0A05ModelfMm.swift" import SwiftData import AppIntents enum FrecuenciaCumplimiento: String, Codable { case diario case semanal case mensual } @Model final class Habit: AppEntity { @Attribute(.unique) var id: UUID var nombre: String var descripcion: String var icono: String var color: String var esHabitoPositivo: Bool var valorObjetivo: Double var unidadObjetivo: String var frecuenciaCumplimiento: FrecuenciaCumplimiento static var typeDisplayRepresentation: TypeDisplayRepresentation = "Hábito" static var defaultQuery = HabitQuery() var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(nombre)") } static var allHabits: [Habit] = [ Habit(id: UUID(), nombre: "uno", descripcion: "", icono: "circle", color: "#BF0000", esHabitoPositivo: true, valorObjetivo: 1.0, unidadObjetivo: "", frecuenciaCumplimiento: .mensual), Habit(id: UUID(), nombre: "dos", descripcion: "", icono: "circle", color: "#BF0000", esHabitoPositivo: true, valorObjetivo: 1.0, unidadObjetivo: "", frecuenciaCumplimiento: .mensual) ] /* static func loadAllHabits() async throws { do { let modelContainer = try ModelContainer(for: Habit.self) let descriptor = FetchDescriptor<Habit>() allHabits = try await modelContainer.mainContext.fetch(descriptor) } catch { // Manejo de errores si es necesario print("Error al cargar hábitos: \(error)") throw error } } */ init(id: UUID = UUID(), nombre: String, descripcion: String, icono: String, color: String, esHabitoPositivo: Bool, valorObjetivo: Double, unidadObjetivo: String, frecuenciaCumplimiento: FrecuenciaCumplimiento) { self.id = id self.nombre = nombre self.descripcion = descripcion self.icono = icono self.color = color self.esHabitoPositivo = esHabitoPositivo self.valorObjetivo = valorObjetivo self.unidadObjetivo = unidadObjetivo self.frecuenciaCumplimiento = frecuenciaCumplimiento } @Relationship(deleteRule: .cascade) var habitRecords: [HabitRecord] = [] } struct HabitQuery: EntityQuery { func entities(for identifiers: [Habit.ID]) async throws -> [Habit] { //try await Habit.loadAllHabits() return Habit.allHabits.filter { identifiers.contains($0.id) } } func suggestedEntities() async throws -> [Habit] { //try await Habit.loadAllHabits() return Habit.allHabits// .filter { $0.isAvailable } } func defaultResult() async -> Habit? { try? await suggestedEntities().first } }
Posted
by adrianat.
Last updated
.
Post not yet marked as solved
0 Replies
291 Views
I have a custom intent with multiple parameters. Two of the parameters are set up to handle disambiguation dialog. The intent definition file for each of these parameters is almost identical except for the parameter names and the wording in the siri dialog. Similarly, the code in the intent handler to resolve these parameters is nearly identical. But when disambiguation is invoked, the Disambiguation Introduction is only spoken by siri for one of the two parameters. What triggers the Disambiguation Introduction to be spoken in one and not the other? Here is the intentHandler code to resolve the first parameter (in which siri will speak the Disambiguation Introduction: - (void)resolvePartsListNameForAddPart:(AddPartIntent *)intent withCompletion:(void (^)(INStringResolutionResult *resolutionResult))completion NS_SWIFT_NAME(resolvePartsListName(for:with:)) API_AVAILABLE(ios(13.0), macos(10.16), watchos(6.0)) { ... NSMutableArray *options; options = [[NSMutableArray alloc] init]; NSString *anOption = [NSString stringWithFormat:@"Use '%@' ", intent.partsListName]; // option 1 [options addObject:anOption]; anOption = [NSString stringWithFormat:@"test1"]; // option 2 [options addObject:anOption]; ... anOption = [NSString stringWithFormat:@"test5"]; // option 6 [options addObject:anOption]; completion([INStringResolutionResult disambiguationWithStringsToDisambiguate:[options copy]]); return; ... } Here is the intentHandler code to resolve the second parameter (in which siri DOES NOT speak the Disambiguation Introduction: - (void)resolveChangeForAddPart:(AddPartIntent *)intent withCompletion:(void (^)(INStringResolutionResult *resolutionResult))completion NS_SWIFT_NAME(resolveChange(for:with:)) API_AVAILABLE(ios(13.0), macos(10.16), watchos(6.0)) { ... NSMutableArray *options; options = [[NSMutableArray alloc] init]; NSString *anOption = [NSString stringWithFormat:WOOD_TYPE_PARM]; // option 1 [options addObject:anOption]; // Option 2 anOption = [NSString stringWithFormat:PART_NAME_PARM]; [options addObject:anOption]; // Option 3 anOption = [NSString stringWithFormat:QUANTITY_PARM]; [options addObject:anOption]; // Option 4 anOption = [NSString stringWithFormat:DIMENSION_PARM]; [options addObject:anOption]; // Option 5 anOption = [NSString stringWithFormat:CANCEL_PARM]; [options addObject:anOption]; completion([INStringResolutionResult disambiguationWithStringsToDisambiguate:[options copy]]); return; } Here is the Intents definition for the working parameter where Siri speaks the Disambiguation Introduction: Here is the Intents definition for the non-working parameter Again, what triggers the Disambiguation Introduction to be spoken in one and not the other? FYI: it does not make any difference whether or not the Disambiguation Introduction has the parameters 'count' and 'change' (i.e. if I make the introduction be Hello World, it still doesn't get spoken).
Posted
by jeffb6688.
Last updated
.
Post not yet marked as solved
0 Replies
339 Views
I have my app that works perfectly fine with app intents and shortcuts in the Shortcut app. I can find my shortcut when I look for my app in spotlight, the only thing that it are not displayed are the suggested entities, even if the param and suggested entities appear on my Shortcut app. I call to the function updateAppShortcutParameters, and I see this error pop up. Could anyone help me understand what I need to do to make it work? Failed to refresh AppShortcut parameters with error: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=159, NSUnderlyingError=0x600005417540 {Error Domain=NSOSStatusErrorDomain Code=-10814 "Unable to find this application extension record in the Launch Services database." UserInfo={_LSFunction=_LSPluginFindWithPlatformInfo, _LSLine=679, NSDebugDescription=Unable to find this application extension record in the Launch Services database., SK=MyDemoAppBinary, IS=false}}, _LSFunction=+[LSBundleRecord bundleRecordWithBundleIdentifier:allowPlaceholder:error:]}
Posted
by alexhl09.
Last updated
.
Post not yet marked as solved
0 Replies
446 Views
I've created a shortcut using an AppIntent and AppIntentProvider. When I try to run the shortcut in the shortcuts app it works well, but if I assign that same shortcut to the new Action Button it shows that something is working (icon shows up on the island) but the perform function is never called. Am I missing something? should I add extra configurations for the action button? thanks
Posted Last updated
.
Post not yet marked as solved
2 Replies
826 Views
I have edited the default widget with Intent, but am being hit with the following errors… it runs perfectly fine if I don’t use an Intent in a static widget Could not find an intent with identifier ConfigurationAppIntent, mangledTypeName: Optional("27trainWidgetsConfigExtension22ConfigurationAppIntentV") associateAppIntent(forUserActivity:) Error converting INIntent to App Intent: AppIntents.PerformIntentError.intentNotFound I think it may be something to do with Info.plist?
Posted Last updated
.
Post not yet marked as solved
0 Replies
421 Views
I'm developing a CarPlay interface to a messaging application but couldn't find how the root CPTemplate, a grid template with button in my case, could activate SiriKit to let the user choose between several actions like we could see in WhatsApp running on CarPlay: There is CPVoiceControlTemplate that seems to do the job but it is only allowed for navigation app category and not messaging and VoIP. Actually my app could activate Siri to compose a message to a selected contact represented by a CPMessageListItem in a CPListTemplate but I couldn't find how to code a CPGridTemplate that activate Siri...
Posted
by VladX06.
Last updated
.
Post not yet marked as solved
6 Replies
6.1k Views
Issue Summary Hi all, I'm working on an Intents Extension for my app, however when I try to run an intent, Xcode pops up the following error: Could not attach to pid: "965" attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.) An image of the error: This only happens when I try debugging the Intent Extension. Running the main app target or another extension target (e.g. notifications) doesn't produce this error. Build Setup Here are the details of my build setup: Mac Mini M1 Xcode 13 Building to iPhone 11 Pro Max, iOS 15.0.2. I've also tried building to my iPad Pro 12.9 w/ iOS 15.1 and hit the same issue. Things I've tried: Make sure "Debug executable" is unchecked in the scheme I've tried changing the Launch setting to "Automatic" and "Wait for the executable to be launched" I've made sure to run sudo DevToolsSecurity -enable on my mac Rebooted iPhone devices + mac mini Uninstalled / reinstalled the app Deleted derived data Removing / reinstalling the development certs in my keychain --> this actually seemed to work initially, but then the problem came back and now it doesn't work anymore. Console Logs I've looked at the console logs while this error occurs to see if it can shed light on the issue. Here are the ones that seemed notable to me. These logs seem to show that Siri is trying to save / write to a file that it does not have access too. Seems very suspicious error 11:42:38.341470-0800 kernel System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference error 11:42:38.342204-0800 assistantd failed to save contact runtime data. error=Error Domain=NSCocoaErrorDomain Code=512 "The file “com.apple.siri.inference” couldn’t be saved in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/com.apple.siri.inference, NSUnderlyingError=0x100fb03a0 {Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error"}} error 11:42:38.342403-0800 assistantd InferenceError<errorId=crSaveToRunTimeDBFailed file=/Library/Caches/com.apple.xbs/Sources/SiriInference/SiriInference-3100.49.3.1.2/SiriInference/SiriInference/ContactResolver/ContactResolver.swift function=logRunTimeData(runTimeData:config:) line=378 msg=> error 11:42:38.465702-0800 kernel 1 duplicate report for System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference Looking for "debugserver" entries, like the error suggests, shows these logs: default 11:42:44.814362-0800 debugserver error: [LaunchAttach] MachTask::TaskPortForProcessID task_for_pid(965) failed: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) default 11:42:44.814476-0800 debugserver 10 +0.011525 sec [03c6/0103]: error: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) err = ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) (0x00000005) default 11:42:44.825704-0800 debugserver error: MachTask::StartExceptionThread (): task invalid, exception thread start failed. default 11:42:44.825918-0800 debugserver error: [LaunchAttach] END (966) MachProcess::AttachForDebug failed to start exception thread attaching to pid 965: unable to start the exception thread default 11:42:44.826025-0800 debugserver error: Attach failed default 11:42:44.828923-0800 debugserver error: Attach failed: "Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.". I've also attached the full details of the error below via a text file if it helps. Any help with this issue would be great, and I'm happy to provide more information if needed. Thanks in advance! Xcode Attach Full Error Details
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
I am receiving this error in some cases when calling request on an INVoiceShortcutCenter. [[INVoiceShortcutCenter sharedCenter] getAllVoiceShortcutsWithCompletion:^(NSArray<INVoiceShortcut *> * _Nullable voiceShortcuts, NSError * _Nullable error) {     if (error) {} }];
Posted
by yleson.
Last updated
.
Post not yet marked as solved
1 Replies
394 Views
I haven’t done any work for Intents so I don’t know why iOS is making Siri suggestions for my app. Every now and then, maybe especially in the morning, my iPhone will show a button at the bottom of the Lock Screen with my app icon, the title of a data record from inside my app, and the caption “Siri suggestion”. Tapping it launches my app but that’s it. The app doesn’t show the record. Why is iOS doing this? Is this some half-baked effect of using iCloud data or Swift Data? I can’t release the app with iOS doing this, and adding proper Intent support would delay the release.
Posted Last updated
.
Post not yet marked as solved
0 Replies
451 Views
I am developing an app for my home and I was planning to control my smart home plug with it. So I decided to create two shortcuts: the first one to turn it on, the second one to turn it off. For this, I created an AppIntent and an AppShortcut file: // AppIntent.swift // Runner import AppIntents import Foundation class MerossPostClass{ var request: URLRequest var power_state: String public init(power_state: String) { self.power_state = power_state let url = URL(string: "myurl")! var request = URLRequest(url: url) request.httpMethod = "POST" struct Message: Encodable { let device_type: String let power_state: String let channel: Int } let message = Message( device_type: "mss425f", power_state: power_state, channel: 4 ) let data = try! JSONEncoder().encode(message) request.httpBody = data request.setValue( "application/json", forHTTPHeaderField: "Content-Type" ) self.request = request } public func post(){ let task = URLSession.shared.dataTask(with: self.request) { data, response, error in let statusCode = (response as! HTTPURLResponse).statusCode if statusCode == 200 { print("SUCCESS") } else { print("FAILURE") } } task.resume() } } var activateMeross = MerossPostClass(power_state: "ON") var deactivateMeross = MerossPostClass(power_state: "OFF") @available(iOS 17, *) struct ActivateMagSafeIntent: AppIntent { static let title: LocalizedStringResource = "Activate MagSafe" func perform() async throws -> some IntentResult { activateMeross.post() return .result() } } @available(iOS 17, *) struct DeactivateMagSafeIntent: AppIntent { static let title: LocalizedStringResource = "Deactivate MagSafe" func perform() async throws -> some IntentResult { deactivateMeross.post() return .result() } } // // AppShortcut.swift // Runner import Foundation import AppIntents @available(iOS 17, *) struct ActivateMagSafeShortcuts: AppShortcutsProvider { @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { AppShortcut( intent: ActivateMagSafeIntent(), phrases: ["Activate MagSafe"] ) AppShortcut( intent: DeactivateMagSafeIntent(), phrases: ["Deactivate MagSafe"] ) } } With this Code I can add the shortcuts to the shortcuts app. Problem As long as my device is attached to the debugger, everything is working just fine and I am able to control my smart plug with the shortcuts. But after I detached my phone from the debugger, the shortcuts are only working every second run. After every other run, I get an iOS error message like 'Couldn't Communicate with a helper application' or 'App was terminated unexpectedly'. Is there anybody who has been facing the same issue or has any idea why this is happening? Thanks in advance!
Posted
by alex_hsv.
Last updated
.
Post not yet marked as solved
0 Replies
319 Views
Hi, I have an app that is used by several Shortcuts. In many cases, users download the Shortcut, install the app, and only use the App through the Shortcut, and only through the in-extension Intent. They might never open the app. I've received complaints from users that the app keeps disappearing: apparently, because the app itself is never opened (only the in-extension Intent is), it doesn't count as an actual usage for offloading, and so the app gets offloaded. What can I do?
Posted Last updated
.
Post not yet marked as solved
0 Replies
344 Views
Hello, I have a question regarding app Intents. I have a simple App Intent and it is working as expected (I can see it in shortcuts and the action shows a phrase and opens my app). I would now want to ask the user for an "App" parameter, that would be any app the user has downloaded on his iPhone. Here my example intent: struct SayPhraseIntent: AppIntent { static var title: LocalizedStringResource = "See a text." static var description = IntentDescription("Just says whatever text you type in.") @Parameter(title: "Text") var text: String? func perform() async throws -> some ProvidesDialog { guard let providedText = text else { throw $phrase.needsValueError("What text do you want to see?") } return .result(dialog: IntentDialog(stringLiteral: providedText)) } } An example of a shortcut that asks this is I have seen some apps do it so it must be possible, but I cannot find anywhere the Type of the @Parameter I would need to get that from a user through the shortcut app. Any help or suggestions would be appreciated.
Posted Last updated
.
Post not yet marked as solved
1 Replies
486 Views
Hi there, I'm trying to use an enum as a @Parameter for my Widget configuration: enum InteractivePlacesWidgetMode: Int, CaseIterable, AppEnum, Comparable, Equatable { typealias RawValue = Int case favourites = 0, recents, nearbyCategory, collections static var typeDisplayRepresentation: TypeDisplayRepresentation = TypeDisplayRepresentation(name: LocalizedStringResource("Mode")) static var caseDisplayRepresentations: [InteractivePlacesWidgetMode: DisplayRepresentation] = [ .favourites: DisplayRepresentation(title: LocalizedStringResource("Favorites")), .recents: DisplayRepresentation(title: LocalizedStringResource("Recents")), .nearbyCategory: DisplayRepresentation(title: LocalizedStringResource("Categories")), .collections: DisplayRepresentation(title: LocalizedStringResource("Collections")) ] static func < (lhs: InteractivePlacesWidgetMode, rhs: InteractivePlacesWidgetMode) -> Bool { lhs.rawValue < rhs.rawValue } static func == (lhs: InteractivePlacesWidgetMode, rhs: InteractivePlacesWidgetMode) -> Bool { lhs.rawValue == rhs.rawValue } } Then on the ConfigurationAppIntent I would like to show some more option only for specific cases, with the following: struct ConfigurationAppIntent: WidgetConfigurationIntent { static var title: LocalizedStringResource = "Configuration" static var description = IntentDescription("Choose what to show") @Parameter(title: LocalizedStringResource("Show"), default: .favourites) var widgetMode: InteractivePlacesWidgetMode @Parameter (title: "Category") var category: CategoryDetail? static var parameterSummary: some ParameterSummary { When(\.$widgetMode, .equalTo, .nearbyCategory) { Summary { \.$widgetMode \.$category } } otherwise: { Summary { \.$widgetMode } } } } But the widget seems to ignore the When clausole at all. Is this a limitation of the When clausole? Is there something wrong with my approach? I already used that with standard types in previous work and it seems to work quite well. Thanks in advance for your help. c.
Posted
by sofapps.
Last updated
.
Post not yet marked as solved
0 Replies
295 Views
My goal is to have pre-made shortcuts with singular app intents, so my customers won't need to create their own shortcuts. I am using the new AppIntents API, which became available last year. I have 3 app intents, which are working as expected. I am using AppShortcutsProvider to advertise my intense as Siri Shortcuts I have updated my AppShortcutsProvider implementation struct LibraryAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { let drink1 = AppShortcut(intent: LogFirstDrink(), phrases: ["\(.applicationName) log first favourite"], shortTitle: "Log 1st favourite", systemImageName: "1.circle") let customDrink = AppShortcut(intent: LogLabelledDrink(), phrases: ["\(.applicationName) log any favourite"], shortTitle: "Log any favourite", systemImageName: "cup.and.saucer") let drink1CustomDate = AppShortcut(intent: LogFirstDrinkAtCustomDate(), phrases: ["\(.applicationName) log first favourite with date"], shortTitle: "Log 1st favourite", systemImageName: "1.square") return [drink1, drink1CustomDate, customDrink] } } ❌ I don't see my app shortcut in the "All Shortcuts" tab (AKA "Shortcuts), the first tab ❌ Sadly, I don't see my app in the beautiful iOS 17 "Suggestions From Your Apps" rectangular views either. Here's an example from Drafts. ❌ I don't see my intents/shortcuts at Spotlight. ✅ I can create custom shortcuts and browse my intents through the "Add Action" flow.
Posted
by borisy.
Last updated
.