firebase/firebaseui-ios-getting-started
Sets up FirebaseUI for SwiftUI authentication in a consumer iOS app. Use when adding FirebaseUI-iOS auth, FirebaseAuthSwiftUI, AuthPickerView, or default FirebaseUI SwiftUI sign-in views to an app repo.
npx skills add https://github.com/firebase/FirebaseUI-iOS --skill firebaseui-ios-getting-started
Use this skill when the user wants FirebaseUI for SwiftUI authentication added to their own iOS app repo. Assume the app should use FirebaseUI's default AuthPickerView unless the user asks for custom auth UI.
GoogleService-Info.plist, FirebaseApp.configure(), Firebase package dependencies, URL types, entitlements, and any auth UI.GoogleService-Info.plist downloaded from the user's Firebase project for the exact iOS bundle ID. Do not invent Firebase config values or reuse sample config.https://github.com/firebase/FirebaseUI-iOSFirebaseAuthSwiftUIFirebaseAppleSwiftUI for Sign in with AppleFirebaseGoogleSwiftUI for GoogleFirebaseFacebookSwiftUI for FacebookFirebasePhoneAuthSwiftUI for PhoneFirebaseTwitterSwiftUI for TwitterFirebaseOAuthSwiftUI for GitHub, Microsoft, Yahoo, or custom OAuth/OIDCFirebaseCore.FirebaseApp.configure() once during launch.UIApplicationDelegateAdaptor if there is no existing app delegate.AuthService:@State so the @Observable service persists across view updates..environment(authService) above AuthPickerView and any authenticated content that needs auth state.AuthPickerView.authService.isPresented = true.authService.authenticationState and authService.currentUser for simple signed-in/signed-out UI.xcodebuild.Adapt names to the user's app. Preserve any existing app delegate and Firebase setup instead of duplicating it.
import FirebaseAuthSwiftUI
import FirebaseCore
import SwiftUI
class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
return true
}
}
@main
struct YourApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import FirebaseAuth
import FirebaseAuthSwiftUI
import SwiftUI
struct ContentView: View {
@State private var authService: AuthService
init() {
_authService = State(initialValue: AuthService(configuration: AuthConfiguration())
.withEmailSignIn())
}
var body: some View {
AuthPickerView {
NavigationStack {
VStack {
Text("Authenticated")
Button("Manage Account") {
authService.isPresented = true
}
Button("Sign Out") {
Task {
try? await authService.signOut()
}
}
}
}
}
.environment(authService)
}
}
Only add provider setup for providers the app actually uses.
FirebaseAuthSwiftUI, call .withEmailSignIn(), and ensure Email/Password is enabled in Firebase Console Authentication.FirebaseGoogleSwiftUI, call .withGoogleSignIn(), add the REVERSED_CLIENT_ID from GoogleService-Info.plist as a URL scheme, and route incoming URLs through GIDSignIn.sharedInstance.handle(url) if the app delegate handles URLs manually.FirebaseAppleSwiftUI, call .withAppleSignIn(), enable Sign in with Apple in the app's capabilities/entitlements and in Firebase Console.FirebaseFacebookSwiftUI, call .withFacebookSignIn(), add fb{app-id} as a URL scheme, set FacebookAppID, FacebookClientToken, and FacebookDisplayName in Info.plist, and forward launch/open-url events to ApplicationDelegate.shared.FirebasePhoneAuthSwiftUI, call .withPhoneSignIn(), enable Phone in Firebase Console. If the app has an app delegate, preserve Auth.auth().setAPNSToken(...), Auth.auth().canHandleNotification(...), and Auth.auth().canHandle(url) handling when present.FirebaseOAuthSwiftUI, call .withOAuthSignIn(...), and ensure the provider is configured in Firebase Console before coding the app UI.ActionCodeSettings with handleCodeInApp = true, a valid URL/domain for the Firebase project, and setIOSBundleID(Bundle.main.bundleIdentifier!).GoogleService-Info.plist is missing. Ask the user to download it from Firebase Console or confirm where it lives.Info.plist or entitlement setup.AuthService instances for the same auth flow. It owns presentation and authentication state; in SwiftUI, prefer a parent-owned @State instance unless the app already has a stronger owner for auth state.authService.currentUser?.email, uid, or other User members, import FirebaseAuth in addition to FirebaseAuthSwiftUI.AuthPickerView already handles default navigation, account conflict resolution, MFA flows, errors, and reauthentication for built-in default views. Avoid reimplementing those unless the user asks for custom views.14.x does not include the FirebaseAuthSwiftUI product, so it is not a valid fallback for this SwiftUI workflow.main branch only after documenting the reproducibility tradeoff.xcodebuild ... -clonedSourcePackagesDirPath SourcePackages, then remove the generated SourcePackages directory before finishing.AuthService before FirebaseApp.configure() runs. Fix previews by calling if FirebaseApp.app() == nil { FirebaseApp.configure() } in the preview setup.Use these when details are needed beyond this skill:
https://github.com/firebase/FirebaseUI-iOS/blob/main/FirebaseSwiftUI/README.mdhttps://github.com/firebase/FirebaseUI-iOS/tree/main/samples/swiftui/FirebaseSwiftUISamplehttps://firebase.google.com/docs/ios/setuphttps://firebase.google.com/docs/authBefore finishing, confirm:
.with...SignIn() calls.GoogleService-Info.plist is included in the app target resources, not just present on disk.FirebaseApp.configure() is called once before auth UI is used.Take firebase/firebaseui-ios-getting-started from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.