19.9 · Dependencies, entities and queries, errors, and build-time metadata
App Intents look like ordinary Swift, but the system creates and discovers them, which changes how you inject dependencies, test them and ship them.
Mental model. An intent is a value the system instantiates: no initializer arguments, discovery at build time, and dependencies it resolves for you.
Running and testing
Dependencies and direct calls.
- How do App Intents get their dependencies, and why does @Dependency crash in a unit test?
The system builds an intent with its zero-argument init, so a store or service cannot be passed in. @Dependency declares what the intent needs, and the app… - How do AppEnum, AppEntity and EntityQuery work together, and how do parameter errors behave?
An AppEnum is a fixed set of choices with a display name per case; an AppEntity is a user-visible object with a stable id, a displayRepresentation and a…
Discovery
How the system learns that your intents exist.
- How does the system find your intents, and why can they not be registered at runtime?
Intents are discovered at build time. When an app or extension target is built, Xcode runs the App Intents metadata processor over the compiled module and…
More in Extensions, widgets & intents
- 19.1 · Extension processes, limits, and sharing data with the app
- 19.2 · Notification Service and Notification Content extensions
- 19.3 · Share, Action, keyboards, message filtering, web extensions and network extensions
- 19.4 · WidgetKit timelines, families, refresh budgets, interactivity and controls
- 19.5 · App Intents, Shortcuts, Siri and Spotlight
- 19.6 · The watch app model, Watch Connectivity, and complications
- 19.7 · Top Shelf on tvOS, and treating extensions as a product API
- 19.8 · Timeline fallbacks, testing, bundles and rendering modes
- 19.10 · Info.plist, bundle ids, app group containers and shared payloads