Connecting your iOS app to Google Firebase
How to store and display data on your iOS mobile application
In my previous article, I discussed the different technologies and programs you will need to develop an iOS mobile application — for technical or non-technical founders.
How to develop apps as a non-technical founder — series
This article is the third article in my “Lean App Studio” series that will help provide a framework for non-technical founders and business owners to develop and scale their apps at an affordable and smart price. The following information will help you understand how to save and display data that has been inputted into your app by a user via Google Firebase.
Why is Firebase important?
If your app requires you to save data (i.e., creating a username, uploading profile pictures, or uploading images/videos), then you will need to connect your application to a database to store and later retrieve or view this data.
How do we save user inputs and data via Firebase?
In my previous article, I mentioned the typical design framework for mobile applications (MVC or Model View Controller). Let’s focus on the Model. The Model is essentially the data that your app boils down to (i.e., user profile photo, username, etc.). Now in order to save that data, we need to connect to Firebase. Firebase is a platform that allows you to create a database within minutes and scale accordingly for free (up until a certain point, but you won’t have to worry in the beginning as there probably isn’t enough traffic to cause concern over your bill). If you have an iOS project developed on Xcode already, you can then connect that code to Firebase to save user data. Firebase provides clear documentation and walkthroughs on how to connect and utilize their key features such as writing and reading data from your iOS project.
What is writing and reading data?
Picture this scenario: you’re about to upload a photo to Instagram. When you click the “Upload” button, pretend that your photo is actually a URL (like www.google.com/myPhoto). The URL is written (or uploaded) to the database and stored. When you view the image in your feed or profile on your app, you are reading the exact URL (www.google.com/myPhoto) from the database.
How do I connect my Xcode project to Firebase?
Firebase’s documentation is incredibly detailed and helpful and gives a step-by-step on how to connect your iOS project. Here’s the link on how to connect Firebase to your iOS project:
Add Firebase to your Apple project | Firebase Documentation
If you don't already have an Xcode project and just want to try out a Firebase product, you can download one of our…
What is Firestore v.s. Realtime database?
Firestore is the latest and greatest database that Firebase offers. Firestore allows you to easily bucket your data into Collections and Documents. For example, a folder in your file system would be a Collection, and the documents within that Collection are Documents. Imagine you are building a social media application and you need to categorize your data. You would probably have a User Collection made up of all the users you have in your application, represented as Documents. These Documents could have fields like “username”, “Bio”, etc.
Real-time database is best used for simple querying and is not as good to use for complex applications. This database is best used for simple or small data sizes.
Can’t figure out which database is best for your app? Use Firebase’s “Choose a database” tool to figure out which database is best suited for your app.
How do all of these things tie together? What do I do next?
Creating a Firebase database now allows you to connect your local iOS project code for added functionality and usability. This will allow you to create complex apps without you having to worry about scaling the “back-end” of your application as it will be handled by Google. After connecting your iOS project to Firebase using the documentation referenced above, you will want to better understand the different tools and features that Firebase offers. In the next article, I will go over how to track bugs and crashes in your app, user analytics, and more.
Want to develop your app at an affordable price?
If you don’t want to code still, don’t worry — I have created an app development studio (“Lean App Studio”) that is affordable and has a fixed pricing model for people looking to get a jump start on their app journey. We take the approach by developing the MVP of your mobile app and scale based on your comfortability. Click the link to schedule a meeting today!
Lean App Studio
We can help you validate and develop the MVP of your iOS app today - quickly and affordably. How it works Schedule…