The following code works perfectly fine in iOS 17, where I can retrieve the desired dependency value through @IntentParameterDependency as expected. However, in iOS 18, addTransaction always returns nil.
struct CategoryEntityQuery: EntityStringQuery {
@Dependency
private var persistentController: PersistentController
@IntentParameterDependency<AddTransactionIntent>(
\.$categoryType
)
var addTransaction
func entities(matching string: String) async throws -> [CategoryEnitity] {
guard let addTransaction else {
return []
}
// ...
}
func entities(for identifiers: [CategoryEnitity.ID]) async throws -> [CategoryEnitity] {
guard let addTransaction else {
return []
}
// ...
}
func suggestedEntities() async throws -> [CategoryEnitity] {
guard let addTransaction else {
return []
}
// ...
}
}
Has anyone else encountered the same issue? Any insights or potential workarounds would be greatly appreciated.
iOS: 18.0 (22A3354)
Xcode 16.0 (16A242d)
App Intents
RSS for tagExtend your app’s custom functionality to support system-level services, like Siri and the Shortcuts app.
Posts under App Intents tag
183 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello everybody!
Does anybody know how to set default values for string array intent field provided dynamically? I want to have preset array field values just after widget added
I have a simple accessory widget with circular and rectangular representation (the first one is for 1 currency value and the second one is for 3 values).
I created CurrencyWidgets.intentdefinition and added AccessoryCurrency custom intent. Here I added string parameter field currencyCode. For this parameter I set the following options:
Supports Multiple Values
Fixed Size (AccessoryCircular = 1, AccessoryRectangular = 3)
User can edit value in Shortcuts
Options are provided dynamically
Then I created CurrencyTypeIntent extension and added IntentHandler for my custom intent AccessoryCurrency. The code is below
class IntentHandler: INExtension, AccessoryCurrencyIntentHandling {
override func handler(for intent: INIntent) -> Any { self }
func provideCurrencyCodeOptionsCollection(for intent: AccessoryCurrencyIntent) async throws -> INObjectCollection<NSString> {
return INObjectCollection(items: [NSString("USD"), NSString("EUR"), NSString("RUB"), NSString("CNY")])
}
func defaultCurrencyCode(for intent: AccessoryCurrencyIntent) -> [String]? {
return ["USD", "EUR", "RUB"]
}
}
The problem is in func defaultCurrencyCode(...): when I return something except nil (for example ["USD"] or ["USD", "EUR", "RUB"]) then I got a broken widget. It hangs in a placeholder state in lock screen and at add widget UI (see the image below).
Otherwise when I return nil then my widget works fine. But when I try to customise widget then I don't have default values for my currencyCode field, only Chose placeholders.
At the same time everything works fine for the single string parameter (without "Supports Multiple Values"). Does anybody know how to make default parameters work for array (multiple) field?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
WidgetKit
Intents
App Intents
Overview
I have a custom type Statistics that has 3 properties inside it
I am trying to return this as part of the AppIntent's perforrm method
struct Statistics {
var countA: Int
var countB: Int
var countC: Int
}
I would like to implement the AppIntent to return Statistics as follows:
func perform() async throws -> some IntentResult & ReturnsValue<Statistics> {
...
...
}
Problem
It doesn't make much sense to make Statistics as an AppEntity as this is only computed as a result.
Statistics doesn't exist as a persisted entity in the app.
Questions
How can I implement Statistics?
Does it have to be AppEntity (I am trying to avoid this)? (defaultQuery would never be used.)
What is the correct way tackle this?
DisplayRepresentation.Image(systemName:tintColor:symbolConfiguration:) no longer applies the provided tintColor reliably since iOS 18.
Observed behavior by OS version:
iOS 17: SF Symbol tint is applied consistently as expected.
iOS 18: SF Symbol tint is inconsistent and sometimes appears with incorrect or seemingly random colors instead of the provided tintColor.
iOS 26: SF Symbol is rendered without any tint (default monochrome), completely ignoring the provided tintColor.
This appears to be a regression in how App Intents renders DisplayRepresentation.Image with tinting across OS versions.
iOS17.5:
iOS 18.6:
iOS26:
Code:
import AppIntents
import UIKit
struct CategoryEntity: AppEntity, Hashable {
var id: Category.ID
var name: String
var icon: Int?
var color: Int?
var parentCategoryName: String?
init(from category: Category) {
self.id = category.id
self.name = category.name
self.icon = category.icon
self.color = category.parent?.color ?? category.color
self.parentCategoryName = category.parent?.name
}
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(
title: "\(name)",
subtitle: parentCategoryName.map { "\($0)" },
image: .init(
systemName: Icon.sfSymbolName(from: icon),
tintColor: ColorTag.from(color)
)
)
}
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Category"
static let defaultQuery = CategoryQuery()
}
[Documentation API]
(https://developer.apple.com/documentation/appintents/displayrepresentation/image-swift.struct/init(systemname:tintcolor:symbolconfiguration:)-3snvy?changes=_5)
Hi!
I have defined the following app intent. It returns a result with a dialog to confirm that the intent has been executed.
Naturally, that dialog needs to be localized properly. But the String interpolation with the provided format doesn't do that.
I specified wide for the width parameter and expect spelled-out unit names. However, in the textual output, Siri always uses the abbreviated unit (e.g. "min" or "s"), in all languages I tested. In the audio output, Siri says "minutes" in English where the textual representation is "min". In German, Siri says "min", so it basically reads the textual representation aloud and that's not quite understandable to the user.
struct StartTimerIntent: AppIntent {
static let title: LocalizedStringResource = "Start New Timer"
static var description = IntentDescription("Starts a timer with a custom duration.")
@Parameter(title: "Duration", description: "The duration of the timer.") var duration: Measurement<UnitDuration>
func perform() async throws -> some IntentResult & ProvidesDialog {
// [code to execute intent goes here]
return .result(
dialog: .init(
full: "\(duration, format: .measurement(width: .wide, usage: .asProvided)) timer started.",
systemImageName: "timer"
)
)
}
}
As this SwiftUI-style formatter doesn't seem to work with localization, I tried a different approach with a MeasurementFormatter:
extension Measurement where UnitType == UnitDuration {
func localized() -> String {
let formatter = MeasurementFormatter()
formatter.locale = .autoupdatingCurrent
formatter.unitOptions = .providedUnit
formatter.unitStyle = .long
return formatter.string(from: self)
}
}
Usage with String interpolation:
"\(duration.localized()) timer started."
This works great as long as these two languages are set to the same language on the user's device:
[UI language] Settings → General → Language & Region → Preferred Language
[Siri langauge] Settings → Apple Intelligence & Siri → Language
However, when they differ, even this method doesn't yield correct results.
For example, I have my general (UI) language set to English, but my Siri language set to German. Then Siri replies in German, but the unit is formatted in English and Siri speaks it in English, so the result is a messed up sentence that's half German, half English.
What is the proper way to localize parameters in dialogs for Siri?
How can I make sure that parameters are localized to match Siri's language?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Localization
App Intents
Greetings, and Happy Holidays,
I've been building an on-device AI safety layer called Newton Engine, designed to validate prompts before they reach FoundationModels (or any LLM). Wanted to share v1.3 and get feedback from the community.
The Problem
Current AI safety is post-training — baked into the model, probabilistic, not auditable. When Apple Intelligence ships with FoundationModels, developers will need a way to catch unsafe prompts before inference, with deterministic results they can log and explain.
What Newton Does
Newton validates every prompt pre-inference and returns:
Phase (0/1/7/8/9)
Shape classification
Confidence score
Full audit trace
If validation fails, generation is blocked. If it passes (Phase 9), the prompt proceeds to the model.
v1.3 Detection Categories (14 total)
Jailbreak / prompt injection
Corrosive self-negation ("I hate myself")
Hedged corrosive ("Not saying I'm worthless, but...")
Emotional dependency ("You're the only one who understands")
Third-person manipulation ("If you refuse, you're proving nobody cares")
Logical contradictions ("Prove truth doesn't exist")
Self-referential paradox ("Prove that proof is impossible")
Semantic inversion ("Explain how truth can be false")
Definitional impossibility ("Square circle")
Delegated agency ("Decide for me")
Hallucination-risk prompts ("Cite the 2025 CDC report")
Unbounded recursion ("Repeat forever")
Conditional unbounded ("Until you can't")
Nonsense / low semantic density
Test Results
94.3% catch rate on 35 adversarial test cases (33/35 passed).
Architecture
User Input
↓
[ Newton ] → Validates prompt, assigns Phase
↓
Phase 9? → [ FoundationModels ] → Response
Phase 1/7/8? → Blocked with explanation
Key Properties
Deterministic (same input → same output)
Fully auditable (ValidationTrace on every prompt)
On-device (no network required)
Native Swift / SwiftUI
String Catalog localization (EN/ES/FR)
FoundationModels-ready (#if canImport)
Code Sample — Validation
let governor = NewtonGovernor()
let result = governor.validate(prompt: userInput)
if result.permitted {
// Proceed to FoundationModels
let session = LanguageModelSession()
let response = try await session.respond(to: userInput)
} else {
// Handle block
print("Blocked: Phase \(result.phase.rawValue) — \(result.reasoning)")
print(result.trace.summary) // Full audit trace
}
Questions for the Community
Anyone else building pre-inference validation for FoundationModels?
Thoughts on the Phase system (0/1/7/8/9) vs. simple pass/fail?
Interest in Shape Theory classification for prompt complexity?
Best practices for integrating with LanguageModelSession?
Links
GitHub: https://github.com/jaredlewiswechs/ada-newton
Technical overview: parcri.net
Happy to share more implementation details. Looking for feedback, collaborators, and anyone else thinking about deterministic AI safety on-device.
parcri.net has the link :)
Description
The Shortcut Automation Trigger Transaction frequently times out, ultimately causing the shortcut automation to fail. Please see the attached trace for details.
Additionally, the Trigger is activated even when the Transaction is declined.
Details
In the trace I see the error:
[WFWalletTransactionProvider observeForUpdatesWithInitialTransactionIfNeeded:transactionIdentifier:completion:]_block_invoke Hit timeout waiting for transaction with identifier: <private>, finishing.
Open bug report: FB14035016
Hi,
I have created an AppIntent in which there is a parameter called price, I have set the default value as 0.
@Parameter(title: "Price", default: 0)
var price: Int
Problem
When the shortcut is run this parameter is skipped
Aim
I still want to price to be asked however it needs to be pre-filled with 0
Question
What should I do that the shortcut can still ask the price but be pre-filled with 0?
使用APPIntent 的AppShortcutsProvider方式,最多只能添加10个AppShortcut,超过10个,代码编译就会报错
struct MeditationShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: StartMeditationIntent(),
phrases: [
"Start a (.applicationName)",
"Begin (.applicationName)",
"Meditate with (.applicationName)",
"Start a (.$session) session with (.applicationName)",
"Begin a (.$session) session with (.applicationName)",
"Meditate on (.$session) with (.applicationName)"
]
)
}
}
如何能做到像特斯拉APP一样
How do I set a custom icon for an app control that appears in Control Shortcuts (swipe down from iOS) ?
Where is the documentation for size and where to put the image, format etc?
Thank you.
Working Code (sfsymbol)
import Foundation
import AppIntents
import SwiftUI
import WidgetKit
// MARK: - Open App Control
@available(iOS 18.0, *)
struct OpenAppControl: ControlWidget {
let kind: String = "OpenAppControl"
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: kind, content: {
ControlWidgetButton(action: OpenAppIntent()) {
Label("Open The App", systemImage: "clock.fill")
}
}
})
.displayName("Open The App") // This appears in the shortcuts view
}
}
Sample Image
These apps use their own image. How can I use my own image?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
SwiftUI
WidgetKit
App Intents
Is there any way of creating complete Shortcuts automations and bundling them with my app? Specifically, I would like the user to be able to
Take a photo and open it with my app
Or take a screenshot and open it with my app
Of course I could offer a Share extension, but going through the Share menu and selecting my app there is time consuming for the user. I would like the user to be able to configure his or her action button such that it takes a new picture and opens it with my app right away.
I can, of course, offer the respective App Shortcuts and let the user combine them into a pipeline with the Take Screenshot or Take Photo system actions. However, only power users would do this. Hence, I would like to bundle this complete pipeline with my app, such that the user just has to assign his/her Action Button to this pipeline if he/she wants to use this feature.
How to go about this? I was thinking of exporting the shortcut into a file, bundling it with the app as a resource, and offering it via a Share action for the user to install it, or by sharing it on iCloud and adding the iCloud link to the UI of my app. What is the recommended approach?
Hi, I’m trying to integrate my iOS app with Shortcuts.
My goal is:
In the Shortcuts app → Create a shortcut → Select an image → Share the image directly to my app for analysis.
However, when I try to add the “Share with App” / “Open in App” / “Send to App” action in Shortcuts:
My app does NOT appear in the list of available apps.
I want my app to be selectable so that Shortcuts can send an image (UIImage / file) to my app.
What I have tried
My app supports receiving images using UIActivityViewController and Share Extension.
I created an App Intents extension (AppIntent + @Parameter(file)...) but the app still does not appear in Shortcuts “Share with App”.
I also checked the Info.plist but didn’t find any permission related to Shortcuts.
The app is installed on the device and works normally.
My question
What permission, Info.plist entry, or capability is required so that my app becomes visible in the Shortcuts app as a target for image sharing?
More specifically:
Which extension type should be used for receiving images from Shortcuts?
App Intents Extension?
Share Extension?
Intent Extension?
Do I need a specific NSExtensionPointIdentifier for Shortcuts integration?
Do I need to declare a custom Uniform Type Identifier (UTI) or add supported content types so Shortcuts knows my app can handle images?
Are there any required entitlements / capabilities to make the app appear inside the “Share with App” action?
Goal Summary
I simply want:
Shortcuts → Pick Image → Send to My App → App receives the image and processes it.
But currently my app cannot be selected in Shortcuts.
Thanks in advance for any guidance!
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Image I/O
Extensions
App Intents
Hi everyone,
I’m currently experimenting with App Intents and I’m trying to customize the section titles that appear at the top of groups of intents inside the Shortcuts app UI.
For example, in the Phone shortcut, there are built-in sections such as “Call Favorite Contacts” and “Call Recent Contacts” (see screenshot attached).
Apple’s own system apps such as Phone, Notes, and FaceTime seem to have fully custom section headers inside Shortcuts with icon.
My question is:
👉 Is there an API available that allows third-party apps to define these titles (or sections) programmatically?
I went through the AppIntents and Shortcuts documentation but couldn’t find anything.
From what I can tell, this might be private / Apple-only behavior, but I’d be happy to know if anybody has found a supported solution or a recommended alternative.
Has anyone dealt with this before?
Thanks!
Mickaël 🇫🇷
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Shortcuts
Intents
App Intents
I am implementing AppIntent into my application as follows:
// MARK: - SceneDelegate
var window: UIWindow?
private var observer: NSObjectProtocol?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
// Setup window
window = UIWindow(windowScene: windowScene)
let viewController = ViewController()
window?.rootViewController = viewController
window?.makeKeyAndVisible()
setupUserDefaultsObserver()
checkShortcutLaunch()
}
private func setupUserDefaultsObserver() {
// use NotificationCenter to receive notifications.
NotificationCenter.default.addObserver(
forName: NSNotification.Name("ShortcutTriggered"),
object: nil,
queue: .main
) { notification in
if let userInfo = notification.userInfo,
let appName = userInfo["appName"] as? String {
print("📱 Notification received - app is launched: \(appName)")
}
}
}
private func checkShortcutLaunch() {
if let appName = UserDefaults.standard.string(forKey: "shortcutAppName") {
print("🚀 App is opened from a Shortcut with the app name: \(appName)")
}
}
func sceneDidDisconnect(_ scene: UIScene) {
if let observer = observer {
NotificationCenter.default.removeObserver(observer)
}
}
}
// MARK: - App Intent
struct StartAppIntent: AppIntent {
static var title: LocalizedStringResource = "Start App"
static var description = IntentDescription("Launch the application with the command")
static var openAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult {
UserDefaults.standard.set("appName", forKey: "shortcutAppName")
UserDefaults.standard.set(Date(), forKey: "shortcutTimestamp")
return .result()
}
}
// MARK: - App Shortcuts Provider
struct AppShortcutsProvider: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: StartAppIntent(),
phrases: [
"let start \(.applicationName)",
],
shortTitle: "Start App",
systemImageName: "play.circle.fill"
)
}
}
the app works fine when starting with shortcut. but when starting with siri it seems like the log is not printed out, i tried adding a code that shows a dialog when receiving a notification from userdefault but it still shows the dialog, it seems like the problem here is when starting with siri there is a problem with printing the log.
I tried sleep 0.5s in the perform function and the log was printed out normally
try? await Task.sleep(nanoseconds: 500_000_000) // 0.5 seconds
I have consulted some topics and they said that when using Siri, Intent is running completely separately and only returns the result to Siri, never entering the Main App. But when set openAppWhenRun to true, it must enter the main app, right? Is there any way to find the cause and completely fix this problem?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
SiriKit
Intents
App Intents
OSLog
I've been implemented App Shortcuts into my apps which are localized for a variety of languages.
The WWDC23 "Spotlight your app with App Shortcuts" has been extremely helpful in resolving my localized trigger phrases issue, but before I continue filling out all of the trigger phrases for my application I am concerned about a limitation that was mention in the video and need some additional information about it.
The limitations noted in the video at minute mark 21:26 states that:
Maximum 10 App Shortcuts (OK)
Maximum 1000 trigger phrases...
If I have 1 app and 10 shortcuts, and each shortcut only uses (.applicationName), this means I get to have 100 trigger phrases for each shortcut (for the sake of the discussion).
What I'm unsure about is when I begin providing localization do the localized triggered phrases count toward the trigger phrase limit? Essentially, for every language I support do I have to drop 1/2 of all of my trigger phrases to stay under the limit?
At the moment, my app is supporting 40 languages and I would like to know how localization affects the trigger phrase limit.
Thank you!
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Shortcuts
Intents
App Intents
Hi everyone,
I'm trying to add the Side Button Access entitlement to my voice-based conversational app following the documentation, but I'm unable to find it in Xcode.
Steps I followed:
Selected my app target in Xcode project navigator
Went to the Signing & Capabilities tab
Clicked the + Capability button
Searched for "Side Button Access"
Problem:
The "Side Button Access" option does not appear in the capabilities list at all.
Environment:
I'm developing and testing in Japan (where this feature should be available)
Xcode version: Xcode 26.2 beta 3
iOS deployment target: iOS 26.2
Questions:
Is there any pre-registration or special approval process required from Apple before this entitlement becomes available?
Are there any additional requirements or prerequisites I need to meet?
Is this feature already available, or is it still in a limited beta phase?
Any guidance would be greatly appreciated. Thank you!
Hello,
I’d like to ask about best practices for handling interactive snippet intents when working with the user’s location.
My use case is:
1. Get the user’s location
2. Fetch nearby data
3. Display it
My current flow is: try to show the snippet view in "loading" state while waiting for Core Location Manager, then fetch data and reload() the view.
BUT I’m running into an issue where I sometimes receive Core Location error 1 (not authorized), even though the main app has “While In Use” authorization.
It seems that in some cases, especially when the app has been force-closed, App Intents are unable to start location updates, even though I’m using supportedModes = .foreground(.dynamic).
Any guidance would be appreciated.
Cheers,
Ondrej
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
Core Location
Maps and Location
Intents
App Intents
I am creating an AppIntent to be used with Shortcuts and I would like to return a flexible dictionary of values with nested structures. As far as I understand the custom AppEntity only uses the displayRepresentation to store a title and subtitle which are LocalizedStringResource. types. Although I can convert my dictionary into a string I found no way in shortcuts to be able to retrieve the original structure of it and inspect individual elements like in subsequent actions. Is there a way to do this?
Thank you in advance
Nick Karanatsios
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line:
Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive.
Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore.
During the archival phase now I am even getting this warning:
MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory.
How can I solve this issue?
If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before.
Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
App intent has a perform method that is async and can throw an error, but I can't find a way to actually await the result and catch the error if needed.
If I convert this working but non-waiting, non-catching code:
Button("Go", intent: MyIntent())
to this (so I can control awaiting and error handling):
Button("Go") {
Task {
do {
try await MyIntent().perform() // 👈
} catch {
print(error)
}
}
}
It crashes:
AppDependency with key "foo" of type Bar.Type was not initialized prior to access. Dependency values can only be accessed inside of the intent perform flow and within types conforming to _SupportsAppDependencies unless the value of the dependency is manually set prior to access.
Although it is invalid since the first version is working like a charm and dependencies are registered in the @main App init method and it is in the perform flow.
So how can we await the result of the AppIntent and handle the errors if needed in the app? Should I re-invent the Dependency mechanism?