@main
struct ABTestingExampleApp: App
main point of entry into app
var appConfig: AppConfig
stores the AppConfig instance
init()
configures the FirebaseApp, configures RemoteConfig, and initializes AppConfig instance
var body: some Scene
returns a WindowGroup
containing a ContentView
with appConfig passed in
class AppConfig: ObservableObject
handles communication with RemoteConfig and updating the UI
@Published var colorScheme: ColorScheme
stores the color scheme for the app
init()
updates app's color scheme from RemoteConfig and adds observer to print installation auth token if it changes on platforms other than Mac Catalyst
deinit
removes installation auth token change observer on platforms other than Mac Catalyst
func updateFromRemoteConfig()
retrieves color scheme from RemoteConfig and updates app's color scheme on the main thread if it has changed
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
func updateFromRemoteConfigAsync() async
retrieves color scheme from RemoteConfig asynchronously and updates app's color scheme on the main thread if it has changed
@objc func printInstallationAuthToken()
prints installation auth token on platforms other than Mac Catalyst
extension ColorScheme
extends ColorScheme to deal with String initializer
init(_ value: String)
returns the corresponding ColorScheme, defaulting to light otherwise
extension RemoteConfigFetchAndActivateStatus
extends RemoteConfigFetchAndActivateStatus with debug description
var debugDescription: String { get }
prints String representation of status
struct ContentView: View
main content view
@ObservedObject var appConfig: AppConfig
stores app's AppConfig instance
var body: some View { get }
returns a FirebaseList
wrapped with NavigationView
when not on macOS
struct FirebaseList: View
multi-platform view for a BasicList
populated with Firebase data
@ObservedObject var appConfig: AppConfig
stores app's AppConfig instance
let data: [(title: String, subtitle: String)]
stores array of title-subtitle String pairings specific to Firebase
var body: some View { get }
returns VStack
containing a BasicList
populated with the Firebase data on top of a "Refresh"
Button
, which updates appConfig's color scheme from Remote Config and is done asynchronously if
refreshed by pulling down on the list on iOS 15, with a navigation title of "Firenotes", preferred
color scheme of appConfig's color scheme, and foreground color corresponding to appConfig's color
scheme (orange for dark color scheme, primary for light color scheme)
struct BasicList: View
view for a basic list of title-subtitle String pairings
let data: [(title: String, subtitle: String)]
stores array of title-subtitle String pairings
var body: some View { get }
returns List
of VStacks
each containing a Text
title on top of a Text
subtitle derived from
data