Artem Kardash
Artem Kardash

Reputation: 121

Prefill realm database swift 3.0

I'd like to use local realm database within the app without any backend connection and I would like to populate this database with initial data. I can't find any documentation on this.

I have:

  1. Described models (as objects extended from RealmSwift)
  2. Data that I want to put in my realm db.

What is the correct flow for putting my data into the realm db and saving it?

Thank you!

Upvotes: 2

Views: 503

Answers (1)

Nordeast
Nordeast

Reputation: 1373

You can download the Realm Browser from the App Store and you can edit an empty realm file or you can import a scheme from a csv or xlsx file. Then save that and include it when you are shipping your app like @David-Pasztor said.

Note that you must have the scheme generated by your code first, and then you can copy the realm file generated and add rows and values.

Upvotes: 0

Related Questions