let defaultPath = Realm.Configuration.defaultConfiguration.fileURL?.path
let path = Bundle.main.path(forResource: "default", ofType: "realm")
if !FileManager.default.fileExists(atPath: defaultPath!), let bundledPath = path {
do {
try FileManager.default.copyItem(atPath: bundledPath, toPath: defaultPath!)
} catch {
print("Error copying pre-populated Realm (error)")
}
}