From e82e39ec6bc5c4f6ae1ef03a1add153f96f043f9 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:24:56 -0400 Subject: [PATCH] [Docs] Prefer fatalError over assert in AppDelegate.swift --- firoptions/FiroptionConfiguration/AppDelegate.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/firoptions/FiroptionConfiguration/AppDelegate.swift b/firoptions/FiroptionConfiguration/AppDelegate.swift index 1311dfc..9fad7a2 100644 --- a/firoptions/FiroptionConfiguration/AppDelegate.swift +++ b/firoptions/FiroptionConfiguration/AppDelegate.swift @@ -36,10 +36,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // [START default_configure_file] // Load a named file. - let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist") - guard let fileopts = FirebaseOptions(contentsOfFile: filePath!) - else { assert(false, "Couldn't load config file") } - FirebaseApp.configure(options: fileopts) + guard + let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist"), + let fileOptions = FirebaseOptions(contentsOfFile: filePath) + else { fatalError("Couldn't load config file.") } + FirebaseApp.configure(options: fileOptions) // [END default_configure_file] // Note: this one is not deleted, so is the default below. @@ -69,7 +70,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Retrieve a previous created named app. guard let secondary = FirebaseApp.app(name: "secondary") - else { assert(false, "Could not retrieve secondary app") } + else { fatalError("Could not retrieve secondary app") } // Retrieve a Real Time Database client configured against a specific app. @@ -80,7 +81,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let defaultDb = Database.database() guard let defapp = FirebaseApp.app() - else { assert(false, "Could not retrieve default app") } + else { fatalError("Could not retrieve default app") } assert(secondaryDb.app == secondary) assert(defaultDb.app == defapp)