Building a Mobile Chat App Using Realm – Integrating with Realm

I’ve just completed an article on how to integrate Realm and Realm Sync into an iOS chat app. It was timed to coincide with the GA of MongoDB Realm Sync.

Realm is used for both persisting data on the iOS device and synchronizing the data between instances of the mobile app.

The app is currently iOS-only (using SwiftUI), but we plan on building an Android version soon. One of the nice things about Realm Sync is that there’s no extra work needed to map between operating systems and languages when syncing data between iOS and Android.

That data is also synced to MongoDB Atlas and so can be accessed from web or other kinds of apps too.

The data stored and synced covers everything in the app:

  • User profile
  • User presence
  • Lists of chatrooms and members
  • The messages themselves

You can download all of the code from the GitHub repo.

Checkout Building a Mobile Chat App Using Realm – Integrating Realm into Your App for all of the details.

Also, if you want to learn more about how the app was built and ask some questions then I’ll be speaking at a virtual meetup on 17th Feb.

4 Likes

Is it possible to view these articles somewhere? I see the new posts for SwiftUI but all of the links to the old blog posts using UIKit now return 404 errors. I use UIKit for my app so it would be helpful to see those

I’ve updated the link, but it’s quite an old post now. This article brings the app up to date to use the newer sync features: Using Realm Flexible Sync in Your App—an iOS Tutorial | MongoDB

Note that both posts use SwiftUI rather than UIKit.

Andrew.