Skip to content

Latest commit

 

History

History
55 lines (47 loc) · 3.16 KB

DESIGN.md

File metadata and controls

55 lines (47 loc) · 3.16 KB

A/B Testing Quickstart SwiftUI Design

Table of Contents

Context

This document presents the design for the SwiftUI version of the Firebase A/B Testing Quickstart, an iOS app that demonstrates the use of Firebase A/B Testing. This SwiftUI version of the Quickstart is meant to show use of Firebase products (A/B Testing, Remote Config, Installations) alongside the latest Apple technologies (SwiftUI, Swift Concurrency, Swift Package Manager) developers might want to use.

Design

The app demonstrates using an A/B Testing experiment to test multiple color schemes within an app, which consists of a static list of Firebase products with a refresh button at the bottom of the screen and pull-to-refresh functionality on iOS 15.

The typical usage flow consists of setting up the A/B Testing experiment in the Firebase Console, enrolling the test device in the experiment, launching the app, moving the test device into / out of the experiment, and refreshing using the button or, if available, the pull-to-refresh functionality.

To handle app state and communication with RemoteConfig, the class AppConfig provides the main logic for reacting to changes to the installation auth token, fetching the color scheme from RemoteConfig, and updating the UI with any changes while also handling error management.

Multi-platform

This Quickstart supports the iOS, tvOS, macOS, watchOS, and Mac Catalyst platforms. Thanks to SwiftUI, all code can be shared across the platforms; the only code difference between the platforms is very intentional: the withholding of NavigationView on macOS and the absence of Firebase Installations on Mac Catalyst. Swift Package Manager makes the integration of Firebase products more streamlined and aligned with up-and-coming best practices for third-party libraries.

Conditional Compilation

The app contains a conditional compilation block which checks for the availability of Swift 5.5 and houses an availability condition which checks for the availability of iOS 15. This allows the app to showcase the latest Apple technologies such as Swift Concurrency like async / await, Tasks, and MainActor while also being backward compatible with iOS 14 or when compiled with earlier versions of Swift.

Further Reading