Firebase
Authentication
Implement user authentication with Firebase Auth.
Overview
Firebase Authentication provides backend services to authenticate users in your iOS app. SwiftStruct supports multiple authentication providers including Apple, Google, GitHub, email/password, and phone number.
Supported Providers
Sign in with Apple
import AuthenticationServices
SignInWithAppleButton()
Email/Password Authentication
EmailTextField()
SignInWithEmailButton()
Social Providers
SignInWithGoogleButton()
SignInWithGitHubButton()
Phone Number
SignInWithPhoneNumberButton()
Authentication Manager
The AuthManager class handles all authentication logic:
import FirebaseAuth
class AuthManager: ObservableObject {
@Published var user: User?
func signIn(with provider: AuthProvider) async throws {
}
func signOut() throws {
}
}
Security
Always enable App Check to protect your Firebase resources from abuse.