WrapFast Documentation

Get Started

In-App Purchases

Firebase

WishKit

AI Backend

Xcode Project

API Client

Support

WrapFast comes out of the box with Firebase integration to implement User Authentication, Cloud Storage with Firestore, Crash reports and Tracking Analytics.

In order to have this implementation up and running, you need to have a Google account and a Firebase project created.

After that, you will have to replace the file GoogleService-Info.plist file in the Xcode project.

Follow the next instructions to configure it.

Creating a Firebase Project

First of all, you need to create a Firebase Project. If you don’t have already an account, create it here

The free tier is quite generous, therefore you don’t have to worry about usage quotas for MVPs. Check Firebase documentation to know more about limits.

When you already have an account, let’s create a Firebase project clicking Add project:

Untitled

Type a name of your project:

Untitled

Enable Google Analytics and Continue.

If you don’t have a Google Analytics Account, create one and Create Project:

Untitled

Add an app to the Firebase Project

When you have the Firebase Project created, click on iOS to add an app:

Untitled

Insert your app bundle id, app name and app id. For this step you need to have created your app in the App Store Connect. Visit In-App Purchases section if you need more info.

Untitled

Click in Register App:

Untitled

<aside> ⚠️ Mind that the bundle ID is camelCase sensitive 👀

</aside>

Download the file GoogleService-Info.plist and replace it for the one in the boilerplate.

Untitled

Hit Next in Firebase until you finish the app creation. Don’t mind the next steps of implementation, it is already done in the boilerplate.

Authentication

WrapFast comes with Sign in with Apple integration to authenticate users. It is the more convenient and user-friendly way to authenticate users. In order to have this up and running you need to configure a couple thins in both Firebase and App Store Connect:

In Firebase Console, go to Authentication:

Untitled

Click on Get Started and then click on Apple in the Additional providers list.

Turn on the Switch Enable, and copy the callback URL that appears down below.

Untitled

Leave this tab opened and go to developer.apple.com > Certificates, Identifiers & Profiles > Identifiers > Plus button > App IDs and find your app identifier.

Untitled

Scroll down and check that Sign in with Apple is checked. If you created the app from Xcode, it should be already checked on as the Capability is already added in the boilerplate.

If you create the App ID manually, you will need to check this on.

Untitled

Create a Service ID for Sign in with Apple in developer.apple.com > Certificates, Identifiers & Profiles > Identifiers > Plus button > Services IDs

Untitled

Type the required info and click Register. I use to set the same bundle id as the app and adding .service at the trailing:

Untitled

Click in the recently created Service ID and check Enabled for Sign in with Apple. After that, click in Configure:

Untitled

In the dropdown menu on top, select your App ID.

In Domain and Subdomaind, type any domain, for example [test.com](<http://test.com>) is valid to have it working.

In Return URLs, paste the callback URL you just have copied in the Firebase tab:

Untitled

Click Next and Done to finish the Service configuration.

Back to the Firebase tab, type your recently created Service ID and click Save:

Untitled

🥳 Congratulations! You have now Sign in with Apple configured to be used in your app.

<aside> 💡 Pro Tip: You can try it with your own Apple account, but I encourage you to create a test Apple account and add it to the Test Users list in the Sandbox. To do so, in App Store Connect, go to Users and Access and add your test Apple Account there. You can also enable Apple Pay to it to test In-App Purchases:

Untitled

</aside>

When an user authenticates successfully with Sign in with Apple with Firebase, it will appear in the User’s list, within the Authentication section in Firebase:

Untitled

Firestore Database

Once you have your user authenticated, you may want to save User’s profile information and other app related data in a database. To do so, WrapFast relies on Firestore Database: a Cloud-hosted, real-time, NoSQL database for app development and synchronization.

Configuring it is pretty straightforward:

Untitled

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

🥳 Congratulations! At this point you have your project totally configured to have the Authentication flow and Cloud Storage.

<aside> 🛠 Run the project in Xcode and try authenticating an User, check in both Firebase Authentication and Firebase Storage that the user is created successfully. Then try to logout and sign in again and try deleting the account from the Settings tab that is built-in in the boilerplate. (The delete account logic is mandatory for passing Apple Reviews)

</aside>

Crashlytics

If you want to receive comprehensive crash reports from your app, WrapFast comes with Firebase Crashlytics implementation. To activate it follow these simple steps:

Untitled

<aside> ⚠️ If it the crash report doesn’t appear repeat the crash test again or try from a physical device. REMEMBER TO FORCE THE CRASH WITH XCODE STOPPED.

</aside>

Analytics

At this point you can track generic usage analytics from your app using Google Analytics. You can even check Realtime Analytics usage in the proper section in Firebase console, within Engage tab.

However, you can track as many custom events as you want. To do so, WrapFast comes with an example implementation that you can find in Tracker.swift

Here you will find a bunch of events to track important actions within your app. You can create as much as you want depending your needs.

Example event without parameters:

Analytics.logEvent("SignUp", parameters: nil)

Example event with parameters:

Analytics.logEvent("ChangeColorScheme", parameters: ["scheme": scheme.title])

🥳 Congratulations! You have all the Firebase integration that comes with WrapFast already configured!