You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess it is OK, but one entity can only be used in a single MOM, otherwise it throws an internal inconsistency exception:
Can't use an entity in two models.
There is no really nice way around it, but internally MOMs are already uniqued based on the input types, so that is probably not a huge deal in practice.
Also, MOMs do not seem to go away when they are released. Or the entities keep a backref to them:
tryautoreleasepool{// doesn't helpletschema1= NSManagedObjectModel(}// Can't use an entity in two models. (NSInternalInconsistencyException)letschema2=NSManagedObjectModel([Fixtures.PersonAddressSchema.Person.self ],
schemaCache: cache
)
Not sure there is a way around this. Entities could be copied, but they are likely still tied to the classes?
The text was updated successfully, but these errors were encountered:
Thinking about it, if any class is requested for an entity, that should result in the same MOM. Because the entity will be bound to it.
Currently the code uniques on the set of types requested.
Well, actually that could be made to work if the entity is never cached, but always built from scratch by the builder.
Though I'm still not convinced it has a relevant use case (unlike freestanding classes in CoreData). The closest one would be sharing types between two different schema versions, but I think that's not even supported by SwiftData.
I guess it is OK, but one entity can only be used in a single MOM, otherwise it throws an internal inconsistency exception:
There is no really nice way around it, but internally MOMs are already uniqued based on the input types, so that is probably not a huge deal in practice.
Also, MOMs do not seem to go away when they are released. Or the entities keep a backref to them:
Not sure there is a way around this. Entities could be copied, but they are likely still tied to the classes?
The text was updated successfully, but these errors were encountered: