Closed OliverDobner-flinc closed 8 years ago
Hi @OliverMahn-flinc
That should already be possible, just provide the bundle where the model is stored.
/**
Initializes a DATAStack using the provided model name, bundle and storeType.
- parameter modelName: The name of your Core Data model (xcdatamodeld).
- parameter bundle: The bundle where your Core Data model is located, normally your Core Data model is in
the main bundle but when using unit tests sometimes your Core Data model could be located where your tests
are located.
- parameter storeType: The store type to be used, you have .InMemory and .SQLite, the first one is memory
based and doesn't save to disk, while the second one creates a .sqlite file and stores things there.
*/
public init(modelName: String, bundle: NSBundle, storeType: DATAStackStoreType) {
self.modelName = modelName
self.modelBundle = bundle
self.storeType = storeType
super.init()
}
Hi, as I said, I can not access the model with a bundle. (Inside a private cocoa pod.) I tried various ways to access the model with bundle access and ended up implementing a method that returns the managed model. So the current initializer don't work for me.
@OliverMahn-flinc Makes sense, I'll look into adding this method if possible. I'll update you if there are any issues with this :) Thanks for adding more info about it.
Thanks for re-opening. 👍
I know it's a long time since you requested this, but I hope it fixes the problem now.
thanks!
I need a way to initialize DATAStack with a given ManagedObjectModel as the model is not in bundle I can access.