Simple iOS App for tracking using Firebase Real-time database

1 -Create blank application in Xcode

2- Install CocoaPods on your Mac

As you’ve already installed CocoaPods, if not click on to link and follow the simple steps. 

3- Add CocoaPods in App

Open Terminal and open your application folder then write command
pod init

You will get a text file named Podfile in your project folder.


4- Add Firebase & Google

Add Firebase and Google maps into the pod file and install.
Open the Podfile in a text editor and add pods then execute this command.

pod install

 # Pods for Rider
 pod ‘Firebase/Database’
 pod ‘GoogleMaps’


5- Open Firebase Console

Open the Firebase console and create a new project.

6- Add iOS App in Firebase

Add the iOS application in Firebase project and connect with Xcode by download google.plist file.
Add the .plist file in your project directory.


7- Add into your Class

Add CLLocationManagerDelegate in your ViewConrtoller Class.

Implement didupdatelocation method
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])


8- Get Location

Get the current location from LocationManager method didUpdateLocation with location of every 10 meters.

locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
  {    self.currentLocation = locations.last}

9- Add Location

Add the current location to firebase database.

self.currentLocation = locations.last 
tref?.setValue([“latlong” : [“lat” : currentLocation.coordinate.latitude , “long” : currentLocation.coordinate.longitude]])

Run and check if the location is updated.

Repeat all the above steps and create another new application in Xcode

10- Add Google maps

Add Google maps on your home screen that displays current location.

11- Add Firebase Observer

Add the Firebase observer (Real-time Firebase database read function). Get the latitude and longitude values from the real time firebase database.
Move the marker on map according to the latest values of longitude and latitude.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments

Let’s Socialize

Popular Post


Share on facebook
Share on twitter
Share on linkedin
Share on tumblr
Share on skype
Share on whatsapp

Flutter vs. React Native

Flutter: Flutter is a UI toolkit used for crafting beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. Flutter is not

Read More »
Would love your thoughts, please comment.x