# Realm and Swift/iOS

**URL:** https://talk.remobjects.com/t/realm-and-swift-ios/11651
**Category:** Fire
**Tags:** swift, realm, elements, ios
**Created:** [December 18, 2016, 10:46pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651 "2016-12-18T22:46:48Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![wdb](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@wdb](https://talk.remobjects.com/u/wdb)
#### Post date: [December 18, 2016, 10:46pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/1 "2016-12-18T22:46:48Z")

</div>

I noticed that someone on the forum has been using Realm together with Fire/Elements. I was wondering if this person could give me tips how to get Realm working with Swift while creating an iOS application.

---

<div class="post-metadata">

### Author: ![JohnMoshakis](https://talk.remobjects.com/user_avatar/talk.remobjects.com/johnmoshakis/32/2286_2.png) [@JohnMoshakis](https://talk.remobjects.com/u/JohnMoshakis)
#### Post date: [December 19, 2016, 2:52am UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/2 "2016-12-19T02:52:06Z")

</div>

You need to download the framework file and create the fx file from that.

You then add the fx as a reference

Download the framework file from

> **[Realm: Create reactive mobile apps in a fraction of the time](https://realm.io/)**
>
> Realm is a mobile platform and a replacement for SQLite & Core Data. Build offline-first, reactive mobile experiences using simple data sync.

I created a train script to run headerimport. Headerimport is the thing that creates the fx file.

[https://docs.elementscompiler.com/Tools/Train/](https://docs.elementscompiler.com/Tools/Train/)

If you want I can give you my trainscript, alternatively I can also give you the latest fx files I have.

It probably wouldn’t take me too long to create an example using swift and Fire.

---

<div class="post-metadata">

### Author: ![wdb](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@wdb](https://talk.remobjects.com/u/wdb)
#### Post date: [December 19, 2016, 1:42pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/3 "2016-12-19T13:42:10Z")

</div>

Great, I have giving it a shot but it looks like Train is a Windows only application? It’s compiling fine but Fire keeps crashing after it has been successfully build.

If you would be able to send me the headers and your fxscript that would be greatly appreciated. I have discovered some Objective-C and Swift libraries. I would love to use in my application e.g. Realm, IGList and Yalantis’ Koloda

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [December 19, 2016, 3:31pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/4 "2016-12-19T15:31:01Z")

</div>

> [@wdb](#):
>
> Great, I have giving it a shot but it looks like Train is a Windows only application?

No, Train is a .NET/Mono command line app, and works fine Mac.

> [@wdb](#):
>
> It’s compiling fine but Fire keeps crashing after it has been successfully build.

sounds like a bug — bit I can’t report tis with what you emailed me; the crash seems to be in debugging, not building, from the log file. what are there exact steps that leads to the crash?

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [December 19, 2016, 3:32pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/5 "2016-12-19T15:32:47Z")

</div>

(fwiw, here it crashes neither when building nor when running/debugging from Fire)

---

<div class="post-metadata">

### Author: ![wdb](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@wdb](https://talk.remobjects.com/u/wdb)
#### Post date: [December 19, 2016, 4:02pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/6 "2016-12-19T16:02:36Z")

</div>

Well, the reproducible steps for me are:

1. Open Fire
2. Open Train.sln
3. Click the Run-button
4. Wait until starts the app and Fire will crash

---

<div class="post-metadata">

### Author: ![wdb](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@wdb](https://talk.remobjects.com/u/wdb)
#### Post date: [December 19, 2016, 4:13pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/7 "2016-12-19T16:13:24Z")

</div>

Ah, the issue happens when you don’t have the Mono framework runtime installed. Crossbox said I was missing the Mono framework on my Mac. After installing Train runs as expected.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [December 19, 2016, 4:20pm UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/8 "2016-12-19T16:20:40Z")

</div>

curious. i’ll see if/how i can simulate that to repro the crash.

---

<div class="post-metadata">

### Author: ![JohnMoshakis](https://talk.remobjects.com/user_avatar/talk.remobjects.com/johnmoshakis/32/2286_2.png) [@JohnMoshakis](https://talk.remobjects.com/u/JohnMoshakis)
#### Post date: [December 20, 2016, 4:17am UTC](https://talk.remobjects.com/t/realm-and-swift-ios/11651/9 "2016-12-20T04:17:50Z")

</div>

[libRealmFramework.train.zip](https://talk.remobjects.com/uploads/default/original/2X/4/445ac960354238a84f8b738d77f0a2a6a760ce29.zip) (630 Bytes)

This is the train script I use. You would need to correct the paths.
