App Schemas let developers describe their app's content and actions using pre-defined domain schemas (like the Calendar domain) so Siri can understand, search, and act on app data without custom NLP. Entities conforming to IndexedEntity are donated to Spotlight's semantic index, enabling natural-language queries over app content.
โข Siri can answer questions about your app's content ("Who's coming to my picnic?") and take actions without any training phrases or NLP work on the developer's end.
โข IndexedEntity + CSSearchableIndex donations enable semantic search โ users can ask about event titles, notes, attendees, and locations in plain English.
โข App Schemas compose relationships between entities (EventEntity โ CalendarEntity โ AttendeeEntity), so Siri understands full context across your data model.
Demonstrates creating a schematized EventEntity using the calendar_event App Schema, conforming to IndexedEntity, and donating it to the Spotlight semantic index so Siri can answer questions about calendar events.
import AppIntents
import CoreSpotlight
import SwiftData
import Foundation
// MARK: - Schematized Calendar Entity
@AppEntity
struct CalendarEntity: IndexedEntity {
static let typeDisplayRepresentation = TypeDisplayRepresentation(name: "Calendar")
static let defaultQuery = CalendarEntityQuery()
var id: UUID
var title: String
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(
title: "\(title)",
image: .init(systemName: "calendar")
)
}
}
struct CalendarEntityQuery: EntityQuery, EnumerableEntityQuery {
@Dependency var calendarManager: CalendarManager
func entities(for identifiers: [UUID]) async throws -> [CalendarEntity] {
calendarManager.calendars
.filter { identifiers.contains($0.id) }
.map { CalendarEntity(id: $0.id, title: $0.title) }
}
func allEntities() async throws -> [CalendarEntity] {
calendarManager.calendars.map { CalendarEntity(id: $0.id, title: $0.title) }
}
}
// MARK: - Schematized Event Entity
@AppEntity
struct EventEntity: IndexedEntity {
static let typeDisplayRepresentation = TypeDisplayRepresentation(name: "Event")
static let defaultQuery = EventEntityQuery()
var id: UUID
var title: String
var startDate: Date
var endDate: Date
var calendar: CalendarEntity?
var notes: String?
var location: String?
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(
title: "\(title)",
subtitle: "\(startDate.formatted(date: .abbreviated, time: .shortened))",
image: .init(systemName: "calendar.badge.clock")
)
}
}
struct EventEntityQuery: EntityQuery {
@Dependency var calendarManager: CalendarManager
func entities(for identifiers: [UUID]) async throws -> [EventEntity] {
calendarManager.events
.filter { identifiers.contains($0.id) }
.map { event in
EventEntity(
id: event.id,
title: event.title,
startDate: event.startDate,
endDate: event.endDate,
notes: event.notes,
location: event.location
)
}
}
}
// MARK: - Donating events to the Spotlight semantic index
@MainActor
final class CalendarManager: ObservableObject {
static let shared = CalendarManager()
var events: [EventModel] = []
var calendars: [CalendarModel] = []
private let searchableIndex = CSSearchableIndex(name: "com.example.cometcal")
func createEvent(_ model: EventModel) async throws {
events.append(model)
let entity = EventEntity(
id: model.id,
title: model.title,
startDate: model.startDate,
endDate: model.endDate,
notes: model.notes,
location: model.location
)
try await searchableIndex.indexAppEntities([entity])
}
func deleteEvent(id: UUID) async throws {
events.removeAll { $0.id == id }
try await searchableIndex.deleteAppEntities(identifiedBy: [id], ofType: EventEntity.self)
}
}
// MARK: - Minimal stub models
struct EventModel {
var id: UUID = UUID()
var title: String
var startDate: Date
var endDate: Date
var notes: String?
var location: String?
}
struct CalendarModel {
var id: UUID = UUID()
var title: String
}Foundation Models is a new Apple framework introduced in iOS 27 that gives developers on-device access to the same Apple Intelligence language model powering system features, enabling text generation, structured output, and tool-calling entirely on-device without a network connection.
iOS 27 opens the Foundation Models framework to third-party LLM providers via a new public LanguageModel protocol, enabling anyone to integrate custom, server-based, or open-source models using the same Swift API as Apple's on-device system model.
iOS 27 introduces GenerateIterativeSegmentationRequest in the Vision framework, letting users interactively isolate any object in an image by providing a point, bounding box, lasso, or scribble as a seed, then iteratively refine the resulting mask.
In-depth guide
iOS 27 On-Device AI & Apple Intelligence โYou must actively donate entities via indexAppEntities on every create/update and call deleteAppEntities on delete โ Siri will not reflect stale or missing data otherwise. TransientAppEntity is the right choice for sub-entities accessed only through a parent (e.g. attendees); do not index them independently or you'll get duplicative Spotlight results. The @Dependency property wrapper requires the object to be registered once at app startup โ failing to register it causes runtime crashes in intents and queries.
Requires Apple Intelligence โ available on iPhone 16 and later, and devices with A17 Pro or M-series chips with sufficient RAM. Apple Intelligence availability varies by region.
Visual Intelligence brings iOS 17's Visual Look Up capabilities to a new developer-facing API surface in iOS 27, letting apps pipe live camera frames or static images through on-device scene understanding to extract subjects, text, barcodes, and rich semantic labels without any cloud round-trip.