mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Setup without .xcdatamodeld file, in a whole new project #397
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnthoPakPak on GitHub (Nov 24, 2022).
Hey!
Thanks for this lib, which looks promising.
Unfortunately, after reading a good part of the docs, I just can't get it. I want to use CoreStore in a fresh new project (no CoreData enabled at the creation).
My understanding is that CoreStore doesn't need xcdatamodeld files.
But the very first setup line (
try CoreStoreDefaults.dataStack.addStorageAndWait()) causes crash because it searches for a momd file.The error is this one: "Could not find "MyApp.momd" from the bundle "com.anthopak.MyApp". Other model files in bundle: 0 item(s) []".
I've tried several variants of creating the DataStack, all leading to this error. I'm sure I'm missing something, probably obvious, but after several hours of searching I end up asking, because I can't fix it by myself...
@JohnEstropia commented on GitHub (Nov 25, 2022):
How are you setting up your store? See this section on the README for a sample on how to declare models without using momd files. Note that your models need to subclass
CoreStoreObjectrather thanNSManagedObject@AnthoPakPak commented on GitHub (Nov 25, 2022):
Thanks for your answer!
So yeah, actually I needed to define my
DataStackusing aCoreStoreSchema. It was indeed written in the docs, but since it was in theMigrationspart, and that I was in the fresh new project (not caring about migrations yet), I've overlooked this part.By reading the docs, it felt like
try CoreStoreDefaults.dataStack.addStorageAndWait()was sufficient for the whole configuration.Anyway, I'm now good with this and will now enjoy the rest of the lib ✌️