{ "$schema": "https://raw.githubusercontent.com/guitaripod/wwdc-sessions/master/schema/session.schema.json", "schemaVersion": 1, "id": "wwdc2026-274", "event": "wwdc2026", "eventName": "WWDC26", "year": 2026, "eventContentId": 274, "title": "What’s new in SwiftData", "description": "Discover the latest enhancements to SwiftData. We’ll show you how to persist custom and third-party types using Codable, and group fetched data into sections in your SwiftUI app. We’ll also explore how to observe data store changes anywhere else using ResultsObserver and HistoryObserver, giving you the flexibility to drive powerful state objects and react precisely to model updates.", "url": "https://developer.apple.com/videos/play/wwdc2026/274", "sosumiURL": "https://sosumi.ai/videos/play/wwdc2026/274", "type": "Video", "publishedAt": "2026-06-08T14:00:00-07:00", "platforms": [ "iOS", "iPadOS", "macOS", "tvOS", "visionOS", "watchOS" ], "keywords": [ "screenshots" ], "topics": [ "Swift", "SwiftUI & UI Frameworks", "App Services" ], "primaryTopic": "App Services", "duration": 773, "hasTranscript": true, "transcriptWordCount": 1933, "availableLanguages": [ "eng", "fra", "jpn", "kor", "por", "spa", "zho" ], "media": { "hls": "https://devstreaming-cdn.apple.com/videos/wwdc/2026/274/4/87fb1efb-9956-414e-8c99-f2579fe86da2/cmaf.m3u8", "downloadHLS": "https://devstreaming-cdn.apple.com/videos/wwdc/2026/274/4/87fb1efb-9956-414e-8c99-f2579fe86da2/cmaf-download.m3u8", "downloadSD": "https://devstreaming-cdn.apple.com/videos/wwdc/2026/274/4/87fb1efb-9956-414e-8c99-f2579fe86da2/downloads/wwdc2026-274_sd.mp4", "downloadHD": "https://devstreaming-cdn.apple.com/videos/wwdc/2026/274/4/87fb1efb-9956-414e-8c99-f2579fe86da2/downloads/wwdc2026-274_hd.mp4", "duration": 773 }, "codeSnippets": [ { "title": "Sectioned fetching", "language": "swift", "startTimeSeconds": 1, "code": "// Sectioned fetching\n\nstruct TripListView: View { \n @Query(sort: \\Trip.startDate,\n sectionBy: \\.destination)\n var trips: [Trip]\n\n var body: some View: {\n List(selection: $selection) {\n ForEach(_trips.sections) {section in\n Section(section.id) {\n ForEach(trips) {trip in\n TripListItem(trip: trip)\n }\n }\n }\n }\n }\n}" }, { "title": "Using Codable", "language": "swift", "startTimeSeconds": 299, "code": "// Using Codable\n\nimport SwiftData\n\n@Model class Trip {\n\n struct Location: Codable {\n var latitude: Double\n var longitude: Double\n }\n\n var name: String\n var destination: String\n\n var startDate: Date\n var endDate: Date\n\n var location: Location?\n @Attribute(.codable) var mapItemIdentifier: MKMapItem.Identifier?\n}" }, { "title": "// Use observation to update map bounds", "language": "swift", "startTimeSeconds": 500, "code": "// Use observation to update map bounds\n\n@Observable @MainActor final class MapCameraController {\n private let resultsObserver: ResultsObserver\n var bounds: MapCameraBounds?\n private var token: ObservationTracking.Token?\n\n init(modelContext: ModelContext) throws {\n resultsObserver = try ResultsObserver(modelContext: modelContext)\n\n token = withContinuousObservation(options: [.didSet]) {[weak self], event in\n self?.bounds = self?.calculateBounds(trips: resultsObserver.results)\n }\n }\n\n private func calculateBounds(trips: [Trip]) -> MapCameraBounds? { / * */ }\n}" }, { "title": "// Using HistoryObserver to sync with a server", "language": "swift", "startTimeSeconds": 501, "code": "// Using HistoryObserver to sync with a server\n\n@SyncActor final class ServerSync {\n private let observer: HistoryObserver\n private var token: ObservationTracking.Token?\n\n func start() throws {\n self.observer = try HistoryObserver(authors: [\"App\"], modelContainer: modelContainer)\n token = withContinuousObservation(options: .didSet) {[weak self] _ in\n _ = self?.observer.eventCounter\n self?.processChanges()\n }\n }\n\n private func processChanges() {\n // Fetch and process history transactions\n }\n}" } ], "resources": [ { "title": "SwiftData", "url": "https://developer.apple.com/documentation/SwiftData", "type": "documentation", "description": "Write your model code declaratively to add managed persistence and efficient", "sosumiURL": "https://sosumi.ai/documentation/SwiftData", "doccJSON": "https://developer.apple.com/tutorials/data/documentation/SwiftData.json" }, { "title": "Adopting SwiftData for a Core Data app", "url": "https://developer.apple.com/documentation/CoreData/adopting-swiftdata-for-a-core-data-app", "type": "samplecode", "description": "Persist data in your app intuitively with the Swift native persistence framework.", "sosumiURL": "https://sosumi.ai/documentation/CoreData/adopting-swiftdata-for-a-core-data-app", "doccJSON": "https://developer.apple.com/tutorials/data/documentation/CoreData/adopting-swiftdata-for-a-core-data-app.json" } ], "path": "sessions/wwdc2026/274-what-s-new-in-swiftdata/", "files": { "metadata": "sessions/wwdc2026/274-what-s-new-in-swiftdata/metadata.json", "readme": "sessions/wwdc2026/274-what-s-new-in-swiftdata/README.md", "transcript": "sessions/wwdc2026/274-what-s-new-in-swiftdata/transcript.md", "transcriptJSON": "sessions/wwdc2026/274-what-s-new-in-swiftdata/transcript.json" } }