Integrate RealmReact with RealmSwift

Hi guys. I have a database using Realm which is defined in packages.json and created in JS. Now i would to move some operation (because of performance) to native part. When i download library in ios with pods there is an error with library versions. So i upgrade my library version in packages.json to latest. Now i try to download native library on ios using cocapods. I downloaded latest version. But now when i am running project i have issue like on the photo.

How can i resolve this problem? I need to have access to database from swift. Maybe it is possible to somehow use in swift realmreact library from JS?

@forfiter9 This is not possible today. We do not support realm-js and RealmSwift in the same app.

@ianward So how can i write some ios native code which is using realm in react native app ?

@forfiter9 You cannot - sorry.

@ianward and how about Objective-C ?

@forfiter9 the swift binding is built on obj-c so no, not at this time

Is this still not possible today? If so, is there a better workaround than creating a NativeModule to expose RealmCocoa/RealmSwift to React Native?

1 Like

Sorry, is there any updates on the topic?

@dsemenov @forfiter9 This is now possible with more recent versions of RealmJS (as of 3.4.0) as it includes a podspec which solves this issue. This has been a huge headache for me but with this new update I am having success with RealmSwift 3.20.0 and RealmJS 3.4.2 in the same project. This means you can independently work on the same realm object with RealmJS/RealmSwift without having to expose anything to RN.


@colinmish Thank you for trying out v3.4.0 together with Realm Swift. We will appreciate if you add a comment to about how you did it. Once added, we can close the issue :slight_smile: