By default, all of our Xcode templates are hooked to a default Firebase project, owned by us. To have the iOS template point to your own Firebase Swift app, you’ll need to follow the steps outlined in this tutorial. Don’t worry, there’s no coding required and nothing is too technical either. This tutorial assumes you’ve already completed the previous tutorial on getting the Xcode project up and running.
1. Create your own Firebase project in Firebase Console
Head over to Firebase console and click on “Add project”. You need to log into your Google account first.
Once you’ve created a project, you’ll always find it on this page. Notice the “iOS App Templates” project, which is what your app is currently using.
2. Create a new Firebase Swift app for iOS
Click the newly created project, which will land you in Firebase Console.
Once there, click on “Add App” button below the title, pick “iOS” and fill out the required fields. Make sure you remember the iOS Bundle ID since you’ll need to modify your Xcode project to use this exact Bundle ID. Once you click “Register App”, you’ll be able to download a config file, named GoogleService-Info.plist.
3. Replace the existing GoogleService-Info.plist file
Locate the downloaded Xcode project in Finder and search for an existing GoogleService-Info.plist. That’s our default configuration file. In order to make your iOS app use your own Firebase backend, you need to replace that default file with the one you’ve downloaded at the previous step. That’s it. Your app will now use your own backend, rather than our default one.
4. Enable Facebook Login in Firebase
Navigate to Authentication -> Sign-in Methods and enable Facebook provider, as in the image below:
5. Set Firestore Read & Write Permissions
In order to allow your iOS app to read & write data directly from the Firebase backend, you need to enable these permissions in Firebase Console. Go to Firebase -> Database -> Firestore -> Rules and set the read and write rules to public, just like in the example below:
6. Enable Firebase Storage
If you’ve downloaded an app template that has photo/video uploading functionality, you also need to enable Firebase Storage, which is the backend component that stores the uploaded media. You can simply do this on the Storage tab in the Firebase Console.
Run the app in Xcode and register a new user. Then head over to Authentication tab in Firebase and notice the user showing up in the Authentication users table. You should also have an entry in Database -> Cloud Firestore -> “users”. If you can find that user in both places, you’ve completed this tutorial. If not, please take a second look at all the steps and make sure you haven’t missed anything.