Post

Replies

Boosts

Views

Activity

Reply to [SwiftData]Is it safe to reference previous VersionedSchema types in a newer schema's models array?
There was an error in the “Questions” section. Here is what I would like to ask. Please review this again. Since SwiftData uses the simple class name (not the fully-qualified name including namespace) as the entity name, this appears to work correctly in practice. But is mixing types from different schema version namespaces in a single models array officially supported behavior? Does SwiftData internally validate that all types in models belong to the declaring schema's namespace? If so, would this approach break in a future SwiftData release? How does SwiftData handle inverse relationships when a newly defined V2 model references an unchanged V1 model? Is there a risk of schema corruption, runtime crashes during migration, or breaking changes in future SwiftData/iOS updates? The alternative — duplicating all 28 model class definitions in every schema version — introduces significant maintenance overhead. Is there a recommended pattern for handling unchanged models when migrating with VersionedSchema?
2w
Reply to [SwiftData]Is it safe to reference previous VersionedSchema types in a newer schema's models array?
There was an error in the “Questions” section. Here is what I would like to ask. Please review this again. Since SwiftData uses the simple class name (not the fully-qualified name including namespace) as the entity name, this appears to work correctly in practice. But is mixing types from different schema version namespaces in a single models array officially supported behavior? Does SwiftData internally validate that all types in models belong to the declaring schema's namespace? If so, would this approach break in a future SwiftData release? How does SwiftData handle inverse relationships when a newly defined V2 model references an unchanged V1 model? Is there a risk of schema corruption, runtime crashes during migration, or breaking changes in future SwiftData/iOS updates? The alternative — duplicating all 28 model class definitions in every schema version — introduces significant maintenance overhead. Is there a recommended pattern for handling unchanged models when migrating with VersionedSchema?
Replies
Boosts
Views
Activity
2w