DEV Community

Cover image for How to Use Firestore and Firebase Realtime Database with Combine in iOS
Raksha for Canopas Software

Posted on

1

How to Use Firestore and Firebase Realtime Database with Combine in iOS

In this post, you will learn how to observe items from the Firebase databases in real-time using combine framework.

The database is at the heart of every application, be it Android, iOS, or the Web. When it comes to iOS databases, there are so many popular options like Coredata, SQLite, and Realm.

They all have a common disadvantage though, they are local databases and thus it’s not sufficient if we want our users to interact with each other or want to store data in the cloud.

If we want to save data in the cloud, we will need a backend, which mostly comes at a huge cost.

That’s where the Firebase database comes into the picture. I’m not going to list out all the benefits of it as it’s a well-known database in the community but you can check out official docs for more information.

Today, we will explore how we can observe items from the database in real-time using combine framework.

Initially, we will understand an example but later we will create an extension that can convert any database reference to a combine stream.

For detailed implementation, please check out canopas blog.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay