Cloud Firestore

As reference for the future, the following is a list of screenshots showing how to set up a new iOS project in Google’s Cloud Firestore.

Create Xcode Project

Create a new Xcode project in the usual way, and take note of the ‘Bundle Identifier’ for use later:

1. Create a new Xcode project
2. Take note of the ‘Bundle Identifier’ (you’ll need it later).

Close Xcode once the project has been saved.

Install CocoaPod

  1. With CocoPods already installed on your Mac, open a Terminal window [ Go > Utilities > Terminal ].
  2. Navigate to the folder in which your Xcode project is saved (the folder with the .xcodeproj file in it).
    • Tip: cd to ‘Change Directory’.
    • Tip: ls to ‘List’ directory.
  3. Run command pod init
  4. Locate your App folder in Finder, and open Podfile in TextEdit (or similar).
  5. Add pod 'Firebase/Firestore' between target and end,
  6. Save & Close Podfile,
  7. Back in Mac Terminal, run pod install, and await completion of installation.
  8. Open the Xcode project using the .xcodeworkspace file.

Note, the above steps take care of the Add Firebase SDK step below.

Set up Google Cloud Firestore

Log in to the Firestore Database section of the Cloud Firestore online console, and follow the steps below to create a new project for the new App:

1. Add A Project
2. Create a Project
3. Turn Off Google Analytics
4. Provisioning Project
5. Project Ready
6. Add Firebase to App
7. Register App
8. Download GoogleService-Info.plist
9. Create Database
10. Start in Test Mode
11. Choose Firestore Location
12. Provisioning Cloud Firestore
13. Ready To Go!

Initialise Xcode Project

To use Firebase in the Xcode Project, the following code should be added to the main Xcode app file:

import SwiftUI
import Firebase

@main
struct MyFirebaseApp: App {
    var body: some Scene {
        init() {
            FirebaseApp.configure()
        }
    }
}

Okay, we should now be good-to-go!