I've used Realm.io a long time ago, back then you'd create or fetch an existing realm by passing a String as key (could be with or without.realm).
Now I'm building an app with realm.io in swift. However I can't seem to figure out how to create a new realm. In the docs I saw you could get a realm by passing a Realm.COnfiguration object which has a fileUrl and readonly proprty (true or false).
Anyways, Do I just touch an empty file? or how can I create a new Realm?
This is what I have, named is a string which must be dynamic in my case:
let config = Realm.Configuration(
fileURL: NSBundle.mainBundle().URLForResource(named, withExtension: "realm"),
readOnly: true
)
return try! Realm(configuration: config)
Aucun commentaire:
Enregistrer un commentaire