Architecture: Swift Macros vs NSManagedObject Subclasses
SwiftData's magic lives in the @Model macro. You add the @Model annotation to a Swift class, and at compile time Swift Macros automatically generate the NSManagedObject conformance code. This compile-time metaprogramming is one of the best use cases for Swift 5.9+ (iOS 17+). Core Data, by contrast, required NSManagedObject subclassing, the .xcdatamodeld GUI editor, Codegen, or manual subclass generation. SwiftData example: @Model class User { var name: String; var email: String } — 3 lines. The same thing in Core Data: NSManagedObject subclass + .xcdatamodeld + relationship configuration = 50+ lines + GUI clicking. Apple's WWDC 2023 'Meet SwiftData' talk showed boilerplate reduced by 85%. Production reality: adding new features is 2-3x faster with SwiftData; but for large migrations, Core Data's versioned model API is still more reliable.