     actionCodeSettings.handleCodeInApp = true
     actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
 
-    Auth.auth().sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings)
+    Auth.auth().sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings) { error in
+      if let error = error {
+        alertItem = AlertItem(
+          title: "The sign in link could not be sent.",
+          message: error.localizedDescription
+        )
+      }
+    }
   }
 
   private func passwordlessSignIn(email: String, link: String,

      }
    }
  }
}

/// A custom styled TextField with an SF symbol icon.

struct ContentView: View {
  @State private var email: String = ""
  @State private var isPresentingSheet = false

  /// This property will cause an alert view to display when it has a non-null value.
  @State private var alertItem: AlertItem? = nil

  var body: some View {
    NavigationView {
