Installation & Setup on iOS

The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON
and synchronized in realtime to every connected client. When you build
cross-platform apps with our Android, iOS, and JavaScript SDKs, all of your
clients share one Realtime Database instance and automatically receive updates with
the newest data.

Prerequisites

Add Firebase Realtime Database to your app

Ensure the following dependencies are in your project's Podfile:

pod 'Firebase/Core'
pod 'Firebase/Database'

Run pod install and open the created .xcworkspace file.

Configure Firebase Database Rules

The Realtime Database provides a declarative rules language that allows you to
define how your data should be structured, how it should be indexed, and when
your data can be read from and written to. By default, read and write access to
your database is restricted so only authenticated users can read or write data.
To get started without setting up Authentication, you can configure your rules
for public access. This does
make your database open to anyone, even people not using your app, so be sure
to restrict your database again when you set up authentication.

Set up Firebase Realtime Database

You must initialize Firebase before any Firebase app reference is created or
used. If you have already done this for another Firebase feature, you can skip
this step.