Getting Started with Firebase for iOS Apps

New Firebase Project

Introduction To Firebase

A Mobile Application needs the backend services for performing various like data storage, caching, files hosting, data monitoring etc. Firebase is a cloud based service which helps the developers to focus on the Application architecture all the backend services are taken care by the Firebase cloud like Database, servers etc. Some useful services provided are as follows:

  1. Remote Database
  2. Remote Config
  3. Analytics
  4. Authentication
  5. Crash Reporting

In this article we will have a detailed go-through on  getting started with Firebase. So let’s get started.

Firebase Setup

In order to get started, first of all we need a Google Account. With your google account credentials please login to the Firebase Console, the link for the console is

Navigate to Firebase Console
Navigate to Firebase Console
  • We need to navigate to the console and Add a new project.
Firebase Console, Create a new project
Firebase Console, Create a new project
  • You will be asked to Enter a project name and well the Country/Region of yours. Enter the required details and click on “CREATE PROJECT”.
Firebase Create Project
Firebase Create Project
  • It will now ask on which platform do you want to add, Select iOS.
  • Now it’s time to provide some Xcode project details like bundle identifier, in my case it is “cr.kv.MyFirstProject”
Xcode Project Bundle Id
Xcode Project Bundle Id
  • Copy this bundle id and enter into the web console.
Provide Bundle ID
Provide Bundle ID
  • Click on Register App. We have just created a New project, we need to link it now to our Xcode Project.
  • It will provide us with a GoogleService-Info.plist file, we need to add this to our project.
GoogleService-Info.plist file for Xcode Project
GoogleService-Info.plist file for Xcode Project
  • Download the file and click on Continue.
  • We are all setup here at the console now we need to move to our Xcode project and add the FirebaseSDK.
Add Firebase to Xcode project
Add FirebaseSDK to Xcode project

Add FirebaseSDK to Xcode project

  • As we have already create a Xcode project named as “MyFirstProject”
  • We will add the SDK to that project.
  • Open Terminal App on Mac and move to the project directory, we will use cocoa pods for SDK installation.
Open terminal
Open terminal
  • Enter the below commands, one by one.
    • initialise pods

pod init

  • Open pod file

open -a textedit podfile

  • In the TextEdit app a podfile will be opened, we need to add following lines in the file.
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
Cocoa pods Installation
Cocoa pods Installation
  • Save the podfile and close the podfile.
  • Enter the next command to install the required pods.

pod install

This will be the desired output.

Pods Installed Successfully.
Pods Installed Successfully.
  • Open the <<projectname.xcworkspace>> file, we hope you have added the GoogleServices-Info.plist file as well.
Snapshot Xcode Project
Snapshot Xcode Project

Now we will add some code in AppDelegate.swift file, please navigate to the file.

This is a kind of final step, in this process.

//  AppDelegate.swift
//  MyFirstProject
//  Created by Chandra Rao on 25/03/18.
//  Copyright © 2018 Chandra Rao. All rights reserved.
import UIKit
import Firebase
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true

And this is how we are set up for using Firebase into our iOS Application.

You can download the whole project from the link here, it can be used as a started project as well for our upcoming Firebase Tutorials.

In our next Tutorials, we will demonstrate how to use the Firebase Database. Please go through the article form the link here.

Author: Chandra.rao

iOS Developer. #Life of an developer.... Learn New technology, Code, Learn New Technology, Code, Death.