Check Mobile App
Read now

Firebase Realtime Database

Save

Firebase Realtime Database uses a NoSQL cloud database to store data. The data stored in it remain available when the app goes offline. It stored data in JSON format.

 

Let start first with the setup of the Firebase database.

 

Step:-1 First go to https://console.firebase.google.com/ and sign in using your Google Account.

Step:-2 Create a new firebase project by following the below screenshots.

Step:-3 Open your firebase project and add your iOS app by following the steps provided by the firebase.

Step:-4 Add ‘Firebase/Database’ in the project and run the command pod install.

Step:-5 Add GoogleService-Info.plist file in your project and FirebaseApp.configure() line in the AppDelegate after that build and run your project.

Step 6:- Now from the firebase console select Realtime Database. And create a new database in test mode.

Step 7:-  After our database is created now we will create a small app “Todo”. This app will save and fetch data from the database.

Let Starts

Steps for creating a ToDo app.

Step 1:- First we create a view controller and add table view and bar button item in it.

 

Step 2:- For the todo data, we create a model. For storing data in the model.

Step 3:- Add the below code over the viewDidLoad method.

Step 4:- We will create an alert containing a text field, from which we get value from the users. We will save this value to our database. We will save hierarchy like inside “Todo” there will be currentDate. And inside the current date, we will save value with the current time.

 

Put the above code inside the bar button item action.

Step 5:- Now we will fetch data from the database and save it inside our model.

we will call this method from viewDidLoad and from our bar button item action.

Step 6:- This is the final step in which we will load data in our table view.

When you run your app you will see its functionality like this.

Thanks for reading the Firebase Realtime Database blog.

You can also check other blogs from here. if you have any issue or suggestion you can leave your query/suggestion in the comment section.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!

Deniel Kerr

Owner and Founder. Opencart

Talk to Sales
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home