Originally created by @bertayyonel95 on GitHub (Nov 4, 2024).
In the app that I'm working on I have been previously using CoreData, and now I am migrating all my CoreData logic to CoreStore. I have some convenience initializers for my CoreData objects as such;
I was wondering if it is possible to use these initializers with create(_ into) ? Since creating the object with those initializers and then using fetchExisting on the transaction doesn't seem to work.
Originally created by @bertayyonel95 on GitHub (Nov 4, 2024).
In the app that I'm working on I have been previously using CoreData, and now I am migrating all my CoreData logic to CoreStore. I have some convenience initializers for my CoreData objects as such;
```swift
convenience init(fromJson json: JSON) {
self.init()
self.addData(fromJson: json)
}
```
I was wondering if it is possible to use these initializers with create(_ into) ? Since creating the object with those initializers and then using fetchExisting on the transaction doesn't seem to work.
Unlike Core Data, CoreStore doesn't allow orphaned objects that do not belong to any store. Instead I would suggest to use the Importing API using ImportableObject or ImportableUniqueObject protocols and use the transaction.import***(...) methods instead.
@JohnEstropia commented on GitHub (Nov 8, 2024):
Unlike Core Data, CoreStore doesn't allow orphaned objects that do not belong to any store. Instead I would suggest to use the [Importing API](https://github.com/JohnEstropia/CoreStore?tab=readme-ov-file#importing-data) using `ImportableObject` or `ImportableUniqueObject` protocols and use the `transaction.import***(...)` methods instead.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @bertayyonel95 on GitHub (Nov 4, 2024).
In the app that I'm working on I have been previously using CoreData, and now I am migrating all my CoreData logic to CoreStore. I have some convenience initializers for my CoreData objects as such;
I was wondering if it is possible to use these initializers with create(_ into) ? Since creating the object with those initializers and then using fetchExisting on the transaction doesn't seem to work.
@JohnEstropia commented on GitHub (Nov 8, 2024):
Unlike Core Data, CoreStore doesn't allow orphaned objects that do not belong to any store. Instead I would suggest to use the Importing API using
ImportableObjectorImportableUniqueObjectprotocols and use thetransaction.import***(...)methods instead.