Summary
SwiftData holds significance for iOS developers looking to support iOS 17 and above, representing a natural progression from Apple’s previous framework, Core Data. Within the context of a declarative Swift environment, SwiftData aligns more seamlessly than before.
In this chapter, we’ve learned about SwiftData’s background, defined the different SwiftData models, created relationships, and customized the model attributes. We moved on to the container – a component that wraps everything together, performs fetches, and saves. Lastly, we migrated our data from different schema versions using lightweight and custom migrations. Throughout the chapter, we saw the heavy use of Swift macros and protocols, which are more suitable for the modern world of Swift compared to Objective-C.
That’s a lot for one chapter! Remember that the data layer is complex to manage and maintain, and there’s much more to learn. The data layer is one side of...