Firebase is a service built by Google, assisting us with a lot of things in the app building process: from authentication, realtime database, cloud storage to Analytic and User tracking. Let’s take a look at this useful tool, and how to add Firebase SDK to your app
First, to use this tool, you need to create a firebase account -> create a new project. Then you need to add firebase to your project following the steps below:
- Go to the Firebase dashboard.
- In the middle of the project dashboard, click the iOS icon (plat_ios) to launch the setup process. If you added an app to your Firebase project, click Add an app to display the platform options.
- Enter bundle id of your app in the iOS bundle field.
- Enter other information of the app: App nick name and App store id
- Select Register app.
Add the Firebase Configuration file:
- In the above section, select Download GoogleService-Info.plist to download the config file
- Drag the file just downloaded above into the project
Then you need to install the Firebase SDK into your app using the pod: Add the following lines to your pod file:
1 2 3 4 5 6 7 8 | # Add the Firebase pod for Google Analytics pod 'Firebase/Analytics' # Add the pods for any other Firebase products you want to use in your app # For example, to use Firebase Authentication and Cloud Firestore pod 'Firebase/Auth' pod 'Firebase/Firestore' |
Then run pod install
In App Delegate import the Firebase library
1 2 | import Firebase |
Then add the following line of code to the application function: didFinishLaunchingWithOptions:
1 2 | FirebaseApp.configure() |
You are finished adding the Firebase SDK to your app.