Skip to content

Instantly share code, notes, and snippets.

@devsandeshnaik
Last active March 31, 2020 13:18
Show Gist options
  • Save devsandeshnaik/5b261297e2df854282a6f0e228055888 to your computer and use it in GitHub Desktop.
Save devsandeshnaik/5b261297e2df854282a6f0e228055888 to your computer and use it in GitHub Desktop.
import Foundation
import CoreData
struct PersitentContainer {
static let shared = PersitentContainer(modelName: "your-model-name")
init(modelName: String) {
let persistanceContainer = NSPersistentContainer(name: modelName)
persistanceContainer.loadPersistentStores { storeDescription, error in
guard error == nil else { fatalError(error!.localizedDescription) }
print("Store configured successfully")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment