-
Atelier de code : intégrez Siri à votre app
Explorez en profondeur un projet Xcode montrant comment intégrer Siri à votre app. Découvrez comment adopter App Schemas pour permettre aux personnes de poser des questions sur des évènements de calendrier et d'effectuer des actions en langage naturel, comme la planification. Découvrez les bonnes pratiques pour rendre le contenu disponible dans l'index sémantique Spotlight et fournir un contexte pour la compréhension à l'écran.
Chapitres
- 0:00 - Introduction
- 1:43 - App Schemas and the plan
- 3:44 - Build the CalendarEntity
- 8:00 - Build the AttendeeEntity
- 10:30 - Build the EventEntity
- 14:34 - Open events with OpenIntent
- 15:30 - Onscreen awareness
- 17:18 - Create events with Siri
- 19:24 - Update events
- 21:30 - Custom snippet views
- 22:30 - Delete events
- 23:35 - Next steps
Ressources
- Integrating your calendar app with Apple Intelligence
- Donating your app’s data and actions to the system
- Donations and discovery
- Making app entities available in Spotlight
- Making actions and content discoverable by Apple Intelligence
- Providing contextual cues to Apple Intelligence and Siri
- Apple Intelligence and Siri AI
- Calendar
- App schema domains
Vidéos connexes
WWDC26
-
Rechercher dans cette vidéo…
-
-
- 0:00 - Introduction
Justin Kang previews the goal: take an existing app and make it available to Siri. A picnic scenario shows Siri searching events, updating times with confirmation, texting attendees, and answering questions, all through conversation.
- 1:43 - App Schemas and the plan
Apps integrate with Apple Intelligence through App Intents, and App Schemas describe content and actions in terms Siri already understands, no training phrases or NLP. Schemas are organized into domains (here, the calendar domain). Introduces the CometCal sample app and the two goals: understand content, and perform actions.
- 3:44 - Build the CalendarEntity
Create a schematized @AppEntity from the calendar_calendar snippet, set the id to UUID, conform to IndexedEntity, wire a @Dependency and @MainActor query (EnumerableEntityQuery with allEntities()), set a display representation, and donate to Spotlight via indexAppEntities and deleteAppEntities.
- 8:00 - Build the AttendeeEntity
Built from calendar_attendee, but conforming to TransientAppEntity instead of IndexedEntity, attendees are accessed only through their event, so they need no identifier, query, or index. Introduces the IntentPerson type and two schematized @AppEnums (calendar_attendeeStatus, calendar_attendeeType).
- 10:30 - Build the EventEntity
The central IndexedEntity (from calendar_event), where the semantic index shines for title and note-content questions. Composes the CalendarEntity and [AttendeeEntity], handles recurrence (Calendar.RecurrenceRule), union values for location and alarms, and event status/span enums.
- 14:34 - Open events with OpenIntent
A small OpenEventIntent conforming to the system.open schema takes an EventEntity and tells the NavigationManager to navigate to it, so tapping an event in Spotlight or Siri opens straight to its detail view.
- 15:30 - Onscreen awareness
Two view modifiers connect the screen to entities: .appEntityIdentifier on the event list and .userActivity (with an EntityIdentifier) on the detail view, letting Siri resolve "this event" or "that third event" without naming the title.
- 17:18 - Create events with Siri
Build CreateEventIntent from calendar_createEvent: fill in parameter types, add a @MainActor @Dependency, and in perform() resolve the schema parameters (location union value, recurrence) into the data layer and return an EventEntity. Siri handles language, clarification, and confirmation.
- 19:24 - Update events
UpdateEventIntent (calendar_updateEvent) mostly mirrors create, but parameters are optional. The key subtlety: an IntentParameter's valueState distinguishes .set with a value (change it), .set with nil (explicitly clear it), and .unset (not part of the request).
- 21:30 - Custom snippet views
Replace Siri's default result card by adding ShowsSnippetView to the intent's return type and returning a custom SwiftUI EventSnippetView, bringing the app's visual personality (cosmic gradient, star icon) into Siri.
- 22:30 - Delete events
DeleteEventIntent is the simplest, just the event plus an optional span for recurring events, and Siri automatically handles confirmation and disambiguation before deleting.
- 23:35 - Next steps
Download the CometCal sample, browse the App Intents documentation for all schemas and domains, write tests with AppIntentsTesting, and watch "Explore advanced App Intents features for Siri and Apple Intelligence."