Skip to content

Commit cdce007

Browse files
authored
Merge pull request #408 from firebase/nc/fatalerror
[Docs] Prefer fatalError over assert in AppDelegate.swift
2 parents 32e6bab + e82e39e commit cdce007

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

firoptions/FiroptionConfiguration/AppDelegate.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3636

3737
// [START default_configure_file]
3838
// Load a named file.
39-
let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist")
40-
guard let fileopts = FirebaseOptions(contentsOfFile: filePath!)
41-
else { assert(false, "Couldn't load config file") }
42-
FirebaseApp.configure(options: fileopts)
39+
guard
40+
let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist"),
41+
let fileOptions = FirebaseOptions(contentsOfFile: filePath)
42+
else { fatalError("Couldn't load config file.") }
43+
FirebaseApp.configure(options: fileOptions)
4344
// [END default_configure_file]
4445

4546
// Note: this one is not deleted, so is the default below.
@@ -69,7 +70,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6970

7071
// Retrieve a previous created named app.
7172
guard let secondary = FirebaseApp.app(name: "secondary")
72-
else { assert(false, "Could not retrieve secondary app") }
73+
else { fatalError("Could not retrieve secondary app") }
7374

7475

7576
// Retrieve a Real Time Database client configured against a specific app.
@@ -80,7 +81,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
8081
let defaultDb = Database.database()
8182

8283
guard let defapp = FirebaseApp.app()
83-
else { assert(false, "Could not retrieve default app") }
84+
else { fatalError("Could not retrieve default app") }
8485

8586
assert(secondaryDb.app == secondary)
8687
assert(defaultDb.app == defapp)

0 commit comments

Comments
 (0)