       }
     }
   }
+}
+
+/// Model object for an `Alert` view.
+struct AlertItem: Identifiable {
+  var id = UUID()
+  var title: String
+  var message: String
 }
 
 /// A custom styled TextField with an SF symbol icon.

    actionCodeSettings.handleCodeInApp = true
    actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)

    Auth.auth().sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings)
  }

  private func passwordlessSignIn(email: String, link: String,

          switch result {
          case let .success(user):
            isPresentingSheet = user?.isEmailVerified ?? false
          case let .failure(error):
            isPresentingSheet = false
            alertItem = AlertItem(
              title: "An authentication error occurred.",
              message: error.localizedDescription
            )
          }
        }
      }
    }
    .sheet(isPresented: $isPresentingSheet) {
      SuccessView(email: email)
    }
    .alert(item: $alertItem) { alert -> Alert in
      Alert(
        title: Text(alert.title),
        message: Text(alert.message)
      )
    }
  }

