I have a swift program that reads CSV files and saves the data to a core data persistent store. I would like to change the location of the persistent store. Per Apple documentation it appears that I should be able to do so by overriding the default directory in a sub class of NSPersistentContainer. Below is my unsuccessful attempt. The Xcode error is "cannot call value of non-function type URL".
final class CoreDataContainer: NSPersistentContainer {
let storePathURL: URL = URL(string: "file:///Users/Chris/Developer/Persistent Store")!
override class func defaultDirectoryURL() -> URL {
return super.defaultDirectoryURL()
.absoluteURL(storePathURL)
}
}
Not sure if this is what you are asking: