If you're using #SwiftData and need undo support with manually created containers (i.e. you have a schema/migrations) you need to add the undoManager manually after creating the container.

container.mainContext.undoManger = UndoManager

Then you need to use it to undo model changes with

container.undoManager?.undo()

just calling undoManager?.undo will not revert model changes.

Ask me how I know?

related: I fixed an undo bug today.

#iOSDev #macOSDev

Just received the author evaluation copy of SwiftData Architecture book!

#iosdev #swiftdata

SwiftData Architecture book has been updated.

- Added HistoryObserver in iOS 27
- Added unit test example for ResultsObserver in iOS 27.

Link: https://azamsharp.school/swiftdata-architecture.html

#iosdev #swiftui #swiftdata

I'm looking for a sample #SwiftUI project using the AppIntents framework to read/write data from/to #CoreData (and/or #swiftdata

Do I use the AppDependencyManager thing? A database singleton?

Do I use the main thread? A background thread/context?

Any idea? Thank you!

#iosdev

SwiftData ResultsObserver: A Practical Example (iOS 27)
https://youtu.be/QySVD7xiW1o?si=ErZAyE2vLd5yQO56

#iosdev #swiftdata

What's new in Swift Data? This WWDC session will dive into...

- Save custom data types conforming Codable
- Observe store changes at data store using ModelResultsObserver and HistoryObserver
- Query now supports sections.

https://developer.apple.com/la/videos/play/wwdc2026/274

#apple #swiftlang #swiftdata #wwdc

Sectioned Queries in SwiftData (iOS 27)
https://youtu.be/I5S8GjWh3yg

#iosdev #swiftdata #swiftui

Thank you to the #SwiftData team for their Group Lab! You all rock and I always learn so much. #wwdc26