|
1 | 1 | # FriendlyFlix |
2 | 2 |
|
3 | | -A sample app for Firebase DataConnect |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This quickstart is a movie tracker app to demonstrate the use of Firebase Data Connect |
| 6 | + with a Cloud SQL database. |
| 7 | + |
| 8 | +For more information about Firebase Data Connect visit [the docs](https://firebase.google.com/docs/data-connect/). |
| 9 | + |
| 10 | +## Getting Started |
| 11 | + |
| 12 | +Follow these steps to get up and running with Firebase Data Connect. For more detailed instructions, |
| 13 | +check out the [official documentation](https://firebase.google.com/docs/data-connect/quickstart). |
| 14 | + |
| 15 | +### 0. Prerequisites |
| 16 | +- Latest version of [Xcode](https://developer.apple.com/xcode/) |
| 17 | +- Latest version of [Visual Studio Code](https://code.visualstudio.com/) |
| 18 | +- The [Firebase Data Connect VS Code Extension](https://marketplace.visualstudio.com/items?itemName=GoogleCloudTools.firebase-dataconnect-vscode) |
| 19 | + |
| 20 | +### 1. Connect to your Firebase project |
| 21 | + |
| 22 | +1. If you haven't already, create a Firebase project. |
| 23 | + * In the [Firebase console](https://console.firebase.google.com), click |
| 24 | + **Add project**, then follow the on-screen instructions. |
| 25 | + |
| 26 | +2. Upgrade your project to the Blaze plan. This lets you create a Cloud SQL |
| 27 | + for PostgreSQL instance. |
| 28 | + |
| 29 | + > Note: Though you set up billing in your Blaze upgrade, you won't be |
| 30 | + charged for usage of Firebase Data Connect or the |
| 31 | + [default Cloud SQL for PostgreSQL configuration](https://firebase.google.com/docs/data-connect/#pricing) during the preview. |
| 32 | + |
| 33 | +3. Navigate to the [Data Connect section](https://console.firebase.google.com/u/0/project/_/dataconnect) |
| 34 | + of the Firebase console, click on the "Get Started" button and follow the setup workflow: |
| 35 | + - Select a location for your Cloud SQL for PostgreSQL database (this sample uses `us-central1`). If you choose a different location, you'll also need to change the `data-connect-ios-sdk/Examples/FriendlyFlix/dataconnect/dataconnect.yaml` file. |
| 36 | + - Select the option to create a new Cloud SQL instance and fill in the following fields: |
| 37 | + - Service ID: `dataconnect` |
| 38 | + - Cloud SQL Instance ID: `fdc-sql` |
| 39 | + - Database name: `fdcdb` |
| 40 | +4. Allow some time for the Cloud SQL instance to be provisioned. After it's provisioned, the instance |
| 41 | + can be managed in the [Cloud Console](https://console.cloud.google.com/sql). |
| 42 | + |
| 43 | +5. If you haven’t already, add an iOS app to your Firebase project, using `com.google.firebase.samples.FriendlyFlix` as the bundle ID. |
| 44 | + Click **Download GoogleService-Info.plist** to obtain your Firebase config file. |
| 45 | + |
| 46 | +### 2. Cloning the repository |
| 47 | + |
| 48 | +1. Clone this repository to your local machine: |
| 49 | + ```sh |
| 50 | + git clone https://github.com/firebase/data-connect-ios-sdk.git |
| 51 | + ``` |
| 52 | + |
| 53 | +2. Move the `GoogleService-Info.plist` config file (downloaded in the previous step) into the root folder of the sample app in the |
| 54 | + `data-connect-ios-sdk/Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/GoogleService-Info.plist` directory. |
| 55 | + |
| 56 | +### 3. Open in Visual Studio Code (VS Code) |
| 57 | + |
| 58 | +1. Open the `data-connect-ios-sdk/Examples/FriendlyFlix` directory in VS Code. |
| 59 | +2. Click on the Firebase Data Connect icon on the VS Code sidebar to load the Extension. |
| 60 | + a. Sign in with your Google Account if you haven't already. |
| 61 | +3. Click on "Connect a Firebase project" and choose the project where you have set up Data Connect. |
| 62 | +4. Click on "Start Emulators" - this should generate the Swift SDK for you and start the emulators. |
| 63 | + |
| 64 | +### 4. Populate the database |
| 65 | +In VS Code, open the `data-connect-ios-sdk/Examples/FriendlyFlix/dataconnect/data_seed.gql` file and click the |
| 66 | + `Run (local)` button at the top of the file. |
| 67 | + |
| 68 | +If you’d like to confirm that the data was correctly inserted, |
| 69 | +open `data-connect-ios-sdk/Examples/FriendlyFlix/dataconnect/movie-connector/queries.gql` and run the `ListMovies` query. |
| 70 | + |
| 71 | +### 5. Running the app |
| 72 | + |
| 73 | +Press the Run button in Xcode to run the sample app on the iOS Simulator. |
0 commit comments