Managers and Utils
AuthManager
AuthManager
AuthManager.swift
Purpose:
Handles all the authentication related tasks such as signing in, signing up, sending magic links, managing the current user session, and signing out.
Key Functions:
getCurrentSession
: Fetches the current user session if available.getSessionFromUrl
: Processes a URL callback after a magic link sign-in, extracting the user session.registerNewUserWithEmail
: Registers a new user using their email and password.signInWithEmail
: Authenticates a user by their email and password.signInWithApple
: Authenticates a user with Sign in with Apple using the provided idToken.sendMagicLink
: Sends a magic link to the user's email for passwordless authentication.signOut
: Signs out the current user.
Usage:
Wisely employed throughout the app in views where user authentication state changes are relevant, such as the SignInView
or the SettingsView
.