I have a lot of text data in multiple text files. How can I effectively create a database (Realm?) With data from these text files so that I can add the database to my Xcode project and load the data into my application?
I saw many tutorials on how to create a Realm database with user-entered data and then load it, but none of them contain pre-created databases. I do not know if Realm is suitable for this program, but I look very good. I downloaded the Realm browser, but I could only browse the databases and could not easily find out how easy it was to create them.
EDIT:
I managed to create a database in Realm and put it in my xcode folder. Then I try to load it like this, but let people not contain the file data, which I am missing:
let path = NSBundle.mainBundle().pathForResource("data", ofType: "realm")
var config = Realm.Configuration(fileURL: NSURL(fileURLWithPath: path!))
config.readOnly = true
let realm = try! Realm(configuration: config)
let peoples = realm.objects(Data)
Data is a class that defines a schema:
class Data : Object {
dynamic var name = ""
dynamic var country = ""
dynamic var discription = ""
dynamic var image = ""
dynamic var cartoon = ""
dynamic var startYear = 0
dynamic var endYear = 0
}
Image of the area file I'm trying to upload:

Thanks for the help!
Eric source
share