Last active
March 31, 2020 13:18
-
-
Save devsandeshnaik/5b261297e2df854282a6f0e228055888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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