Realm: Bundling a Realm with an App
<p>I want to ship my app with several databases.</p>

<p>1) I have a random generated ".csv" file converted with Realm Browser to "default.realm". </p>

<p>2) I put it in /project_name/project_name/Resources and drop it inside Xcode to project files.</p>

<p>3) I checked "Copy bundle resources"<a href="https://i.stack.imgur.com/7h7g3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7h7g3.png" alt="enter image description here"></a></p>

<p>4)Created </p>

<pre><code>import RealmSwift

class CarItem: Object {
    dynamic var id = String()
    dynamic var first_name = String()
}
</code></pre>

<p>In ViewDidLoad wanted to return results from file</p>

<pre><code>override func viewDidLoad() {
super.viewDidLoad()

   let conf = Realm.Configuration(
        fileURL: NSBundle.mainBundle().URLForResource("default", withExtension: "realm"),
        readOnly: true)

   let realm = try! Realm(configuration: conf)
   let results = realm.objects(Item.self)
   print(results)
}
</code></pre>

<p>5) But results are empty (database have 1000 rows all filled with data).... what am i down wrong?</p>