Artificial intelligent assistant

iOSでRealmに初期データをセットしたい Realm Realm







Places.realm


let mainBundle = NSBundle.mainBundle()
let seedFilePath = mainBundle.pathForResource("Places", ofType: "realm")

let config = Realm.Configuration(readOnly: true, path: seedFilePath)

Realm.Configuration.defaultConfiguration = config

let realm = try! Realm()





let mainBundle = NSBundle.mainBundle()
let seedFilePath = mainBundle.pathForResource("Places", ofType: "realm")

let documentDir: NSString = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
let realmPath = documentDir.stringByAppendingPathComponent("Places.realm")

try! NSFileManager().copyItemAtPath(seedFilePath!, toPath: realmPath)

let config = Realm.Configuration(readOnly: true, path: realmPath)

let realm = try! Realm()


tvOS

<

Realm < Facebook <

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 9b624c30a6a253a0d96a1f45d1cbe3e9