diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/ContentView.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/ContentView.swift
index 722c4b46cc6..0ad9b348098 100644
--- a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/ContentView.swift
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/ContentView.swift
@@ -143,6 +143,31 @@ struct ContentView: View {
}
}
.tint(Color(.label))
+ NavigationLink {
+ FullCustomizationExample()
+ .navigationTitle("Full customization")
+ .navigationBarTitleDisplayMode(.inline)
+ } label: {
+ VStack(alignment: .leading, spacing: 16) {
+ Text("Full customization example")
+ .font(.headline)
+ .fontWeight(.bold)
+ Text("How to draw every auth screen yourself with AuthPickerView")
+ Text(
+ "• Custom first screen, pushed screens and signed-in screen\n• Four switchable themes\n• Library still drives auth, MFA and navigation"
+ )
+ .font(.caption)
+ .foregroundColor(.secondary)
+ }
+ .multilineTextAlignment(.leading)
+ .padding()
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background {
+ RoundedRectangle(cornerRadius: 16)
+ .fill(Color(UIColor.secondarySystemBackground))
+ }
+ }
+ .tint(Color(.label))
}
.padding()
.navigationTitle("FirebaseUI Demo")
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/Contents.json
new file mode 100644
index 00000000000..6e965652df6
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/Contents.json
@@ -0,0 +1,9 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "provides-namespace" : true
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/Contents.json
new file mode 100644
index 00000000000..2826852cb4d
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "images" : [
+ {
+ "filename" : "doggo-mascot.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/doggo-mascot.svg b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/doggo-mascot.svg
new file mode 100644
index 00000000000..03bcbddf78a
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-mascot.imageset/doggo-mascot.svg
@@ -0,0 +1,22 @@
+
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/Contents.json
new file mode 100644
index 00000000000..c568876d357
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "images" : [
+ {
+ "filename" : "doggo-pattern.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/doggo-pattern.svg b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/doggo-pattern.svg
new file mode 100644
index 00000000000..6270097dbd9
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/doggo-pattern.imageset/doggo-pattern.svg
@@ -0,0 +1,600 @@
+
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/Contents.json
new file mode 100644
index 00000000000..28bd88c8b1f
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "images" : [
+ {
+ "filename" : "google-g.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/google-g.svg b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/google-g.svg
new file mode 100644
index 00000000000..821bc87e79d
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/google-g.imageset/google-g.svg
@@ -0,0 +1,11 @@
+
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/Contents.json
new file mode 100644
index 00000000000..a9869d91ac6
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "images" : [
+ {
+ "filename" : "grid-pattern.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/grid-pattern.svg b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/grid-pattern.svg
new file mode 100644
index 00000000000..a92ee1512a3
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/grid-pattern.imageset/grid-pattern.svg
@@ -0,0 +1,90 @@
+
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/Contents.json b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/Contents.json
new file mode 100644
index 00000000000..d987d9c76c6
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x",
+ "filename" : "spark-blob@2x.png"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/spark-blob@2x.png b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/spark-blob@2x.png
new file mode 100644
index 00000000000..bc2b898406f
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Assets.xcassets/FullCustomization/spark-blob.imageset/spark-blob@2x.png differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoAccountScreens.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoAccountScreens.swift
new file mode 100644
index 00000000000..5a646357d77
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoAccountScreens.swift
@@ -0,0 +1,428 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import CoreImage.CIFilterBuiltins
+import FirebaseAuth
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+// The original designs don't cover these screens; their copy and structure follow the
+// FirebaseUI-Android full customization demo, restyled with the theme's Landing values.
+
+struct DemoSignedIn: View {
+ let state: SignedInContentState
+
+ var body: some View {
+ DemoPage(title: "You're in") {
+ DemoBodyText("Signed in as \(state.user?.email ?? state.user?.phoneNumber ?? "you").")
+ // Email verification only applies to an account with an email, and only accounts that
+ // sign in with a password can change one.
+ let hasEmail = state.user?.email != nil
+ let hasPassword = state.user?.providerData.contains { $0.providerID == "password" } ?? false
+ if hasEmail, !state.isEmailVerified {
+ DemoBodyText("Check your inbox to verify your email address.")
+ DemoButton(
+ title: "Verify email",
+ kind: .secondary,
+ identifier: "verify-email-button",
+ action: state.verifyEmail
+ )
+ }
+ DemoErrorText(message: state.errorMessage)
+ if hasPassword {
+ DemoButton(
+ title: "Change password",
+ identifier: "update-password-button",
+ action: state.updatePassword
+ )
+ }
+ if state.isMFAEnabled {
+ DemoButton(
+ title: "Manage two-factor",
+ kind: .secondary,
+ identifier: "mfa-management-button",
+ action: state.goToMFAManagement
+ )
+ }
+ DemoLink(
+ title: "Sign out",
+ alignment: .leading,
+ identifier: "sign-out-button",
+ action: state.signOut
+ )
+ DemoLink(
+ title: "Delete account",
+ alignment: .leading,
+ identifier: "delete-account-button",
+ action: state.deleteAccount
+ )
+ }
+ .disabled(state.isLoading)
+ }
+}
+
+struct DemoMFAManagement: View {
+ var body: some View {
+ MFAManagementScreen { state in
+ DemoPage(title: "Two-factor") {
+ if state.enrolledFactors.isEmpty {
+ DemoBodyText("Add a second step to sign-in, so a password on its own isn't enough.")
+ } else {
+ DemoBodyText("Already on this account")
+ ForEach(state.enrolledFactors, id: \.uid) { factor in
+ DemoFactorRow(factor: factor) {
+ state.unenroll(factor.uid)
+ }
+ .disabled(state.isLoading)
+ }
+ }
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: state.enrolledFactors.isEmpty ? "Set up two-factor" : "Add another method",
+ isLoading: state.isLoading,
+ identifier: "add-factor-button",
+ action: state.goToEnrollment
+ )
+ }
+ }
+ }
+}
+
+private struct DemoFactorRow: View {
+ let factor: MultiFactorInfo
+ let remove: () -> Void
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+ @Environment(\.isEnabled) private var isEnabled
+
+ var body: some View {
+ let theme = themeID.theme
+ let shape = RoundedRectangle(cornerRadius: theme.fieldCornerRadius)
+ HStack(spacing: 16) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(factor.displayName ?? "Second step")
+ .demoText(theme.fieldText)
+ Text(factor.factorID == PhoneMultiFactorID
+ ? (factor as? PhoneMultiFactorInfo)?.phoneNumber ?? "Text message"
+ : "Authenticator app")
+ .font(theme.fieldText.font(relativeTo: .footnote))
+ .foregroundStyle(theme.fieldPlaceholder)
+ }
+ Spacer()
+ Button("Remove", action: remove)
+ .font(theme.link.font())
+ .foregroundStyle(theme.link.color)
+ .buttonStyle(.plain)
+ .opacity(isEnabled ? 1 : 0.5)
+ .accessibilityIdentifier("remove-factor-button")
+ }
+ .padding(.horizontal, 16)
+ .frame(minHeight: 56)
+ .background(theme.fieldFill, in: shape)
+ .overlay { shape.strokeBorder(theme.fieldStroke.color, lineWidth: theme.fieldStroke.width) }
+ }
+}
+
+struct DemoMFAEnrolment: View {
+ var body: some View {
+ MFAEnrolmentScreen { DemoMFAEnrolmentContent(state: $0) }
+ }
+}
+
+/// The enrolment steps, apart from `MFAEnrolmentScreen` so they can be previewed with a stub
+/// state: the Auth emulator can't enrol TOTP.
+struct DemoMFAEnrolmentContent: View {
+ let state: MFAEnrolmentContentState
+
+ var body: some View {
+ switch state.step {
+ case .selectFactor:
+ DemoPage(title: "Secure your account") {
+ DemoBodyText("Add a second step to sign-in, so a password on its own isn't enough.")
+ ForEach(state.allowedFactors, id: \.self) { factor in
+ DemoChoiceRow(
+ title: factor == .sms ? "Text message" : "Authenticator app",
+ isSelected: state.selectedFactorType.wrappedValue == factor,
+ identifier: factor == .sms ? "sms-factor-button" : "totp-factor-button"
+ ) {
+ state.selectedFactorType.wrappedValue = factor
+ }
+ }
+ DemoErrorText(message: state.isMFAEnabled
+ ? state.errorMessage
+ : "Two-factor sign-in isn't enabled for this app.")
+ DemoButton(
+ title: "Continue",
+ isLoading: state.isLoading,
+ identifier: "start-enrollment-button",
+ action: state.startEnrollment
+ )
+ .disabled(!state.isValid)
+ }
+ case .enterPhoneNumber:
+ DemoPage(title: "Add your number") {
+ DemoBodyText("We'll text a code to this number whenever you sign in.")
+ displayNameField(state)
+ DemoPhoneNumberField(phoneNumber: state.phoneNumber, country: state.selectedCountry)
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ .disabled(!state.isValid)
+ }
+ case .enterVerificationCode:
+ DemoPage(title: "Confirm the code") {
+ DemoBodyText("We sent a code to \(state.sentPhoneNumber ?? "your phone").")
+ DemoCodeField(code: state.verificationCode, identifier: "verification-code-field")
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "enroll-button",
+ action: state.enroll
+ )
+ .disabled(!state.isValid)
+ DemoLink(
+ title: "Resend code",
+ alignment: .leading,
+ identifier: "resend-code-button",
+ action: state.sendCode
+ )
+ }
+ case .setUpTOTP:
+ DemoPage(title: "Scan to set up") {
+ DemoBodyText("Scan this with your authenticator app, or type the key in by hand.")
+ if let url = state.totpQRCodeURL {
+ DemoQRCode(url: url)
+ }
+ if let secret = state.totpSecret {
+ DemoLink(
+ title: state.didCopySecret ? "Copied" : secret,
+ alignment: .center,
+ identifier: "totp-secret",
+ action: state.copySecret
+ )
+ }
+ displayNameField(state)
+ DemoCodeField(code: state.totpCode, identifier: "totp-code-field")
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "enroll-button",
+ action: state.enroll
+ )
+ .disabled(!state.isValid)
+ }
+ // Later releases may add steps.
+ @unknown default:
+ DefaultMFAEnrolmentContent(state: state)
+ }
+ }
+
+ private func displayNameField(_ state: MFAEnrolmentContentState) -> some View {
+ DemoTextField(
+ icon: "person",
+ placeholder: "Name this method",
+ text: state.displayName,
+ identifier: "display-name-field"
+ )
+ }
+}
+
+#if DEBUG
+ extension MFAEnrolmentContentState {
+ /// The TOTP setup step with stub values and no-op actions.
+ static var totpSetUpPreview: MFAEnrolmentContentState {
+ MFAEnrolmentContentState(
+ step: .setUpTOTP,
+ selectedFactorType: .constant(.totp),
+ phoneNumber: .constant(""),
+ selectedCountry: .constant(.default),
+ verificationCode: .constant(""),
+ totpCode: .constant(""),
+ displayName: .constant(""),
+ startEnrollment: {},
+ sendCode: {},
+ enroll: {},
+ copySecret: {},
+ isMFAEnabled: true,
+ allowedFactors: [.sms, .totp],
+ sentPhoneNumber: nil,
+ totpSecret: "JBSWY3DPEHPK3PXP",
+ totpQRCodeURL: URL(
+ string: "otpauth://totp/FirebaseUI:rover@example.com?secret=JBSWY3DPEHPK3PXP&issuer=FirebaseUI"
+ ),
+ didCopySecret: false,
+ isValid: false,
+ isLoading: false,
+ errorMessage: nil
+ )
+ }
+ }
+
+ #Preview("TOTP setup") {
+ NavigationStack {
+ DemoMFAEnrolmentContent(state: .totpSetUpPreview)
+ }
+ }
+#endif
+
+struct DemoMFAResolution: View {
+ let mfaRequired: MFARequired
+
+ var body: some View {
+ MFAResolutionScreen(mfaRequired: mfaRequired) { state in
+ DemoPage(title: "One more step") {
+ if state.hints.count > 1 {
+ ForEach(Array(state.hints.enumerated()), id: \.offset) { index, hint in
+ DemoChoiceRow(
+ title: label(for: hint),
+ isSelected: state.selectedHintIndex.wrappedValue == index,
+ identifier: "hint-\(index)-button"
+ ) {
+ state.selectedHintIndex.wrappedValue = index
+ }
+ }
+ }
+ if let hint = selectedHint(state) {
+ switch hint {
+ case let .phone(_, _, phoneNumber):
+ if state.isCodeSent {
+ DemoBodyText("We sent a code to \(phoneNumber ?? "your phone").")
+ DemoCodeField(code: state.verificationCode, identifier: "verification-code-field")
+ } else {
+ DemoBodyText("We'll text a code to \(phoneNumber ?? "your phone").")
+ }
+ case .totp:
+ DemoBodyText("Enter the 6-digit code your authenticator app is showing right now.")
+ DemoCodeField(code: state.totpCode, identifier: "totp-code-field")
+ }
+ }
+ DemoErrorText(message: state.errorMessage)
+ if case .phone = selectedHint(state), !state.isCodeSent {
+ DemoButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ } else {
+ DemoButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "resolve-button",
+ action: state.resolve
+ )
+ .disabled(!state.isValid)
+ }
+ DemoLink(
+ title: "Cancel",
+ alignment: .leading,
+ identifier: "cancel-button",
+ action: state.cancel
+ )
+ }
+ }
+ }
+
+ private func selectedHint(_ state: MFAResolutionContentState) -> MFAHint? {
+ let index = state.selectedHintIndex.wrappedValue
+ return state.hints.indices.contains(index) ? state.hints[index] : nil
+ }
+
+ private func label(for hint: MFAHint) -> String {
+ switch hint {
+ case let .phone(displayName, _, _): displayName ?? "Text message"
+ case let .totp(displayName, _): displayName ?? "Authenticator app"
+ }
+ }
+}
+
+/// A choice between second factors, drawn in the text field's style.
+private struct DemoChoiceRow: View {
+ let title: String
+ let isSelected: Bool
+ var identifier: String
+ let action: () -> Void
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ let theme = themeID.theme
+ let shape = RoundedRectangle(cornerRadius: theme.fieldCornerRadius)
+ Button(action: action) {
+ HStack {
+ Text(title)
+ .demoText(theme.fieldText)
+ Spacer()
+ Image(systemName: isSelected ? "checkmark.circle.fill" : "circle")
+ .foregroundStyle(theme.fieldIcon)
+ }
+ .padding(.horizontal, 16)
+ .frame(minHeight: 56)
+ .background(theme.fieldFill, in: shape)
+ .overlay {
+ shape.strokeBorder(theme.fieldStroke.color, lineWidth: theme.fieldStroke.width)
+ }
+ }
+ .buttonStyle(.plain)
+ .accessibilityAddTraits(isSelected ? .isSelected : [])
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// A QR code for the TOTP setup URL, drawn with Core Image once per URL.
+struct DemoQRCode: View {
+ let url: URL
+
+ @State private var image: UIImage?
+
+ var body: some View {
+ Group {
+ if let image {
+ Image(uiImage: image)
+ .interpolation(.none)
+ .resizable()
+ } else {
+ Color.clear
+ }
+ }
+ .frame(width: 176, height: 176)
+ .padding(12)
+ .background(.white, in: RoundedRectangle(cornerRadius: 24))
+ .frame(maxWidth: .infinity)
+ .accessibilityLabel("QR code for your authenticator app")
+ .accessibilityIdentifier("totp-qr-code")
+ .task(id: url) {
+ image = Self.makeImage(for: url)
+ }
+ }
+
+ /// Shared, since a `CIContext` is expensive to create.
+ private static let context = CIContext()
+
+ private static func makeImage(for url: URL) -> UIImage? {
+ let filter = CIFilter.qrCodeGenerator()
+ filter.message = Data(url.absoluteString.utf8)
+ guard let output = filter.outputImage?.transformed(by: CGAffineTransform(scaleX: 8, y: 8)),
+ let cgImage = context.createCGImage(output, from: output.extent) else {
+ return nil
+ }
+ return UIImage(cgImage: cgImage)
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoComponents.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoComponents.swift
new file mode 100644
index 00000000000..4a90d62cf12
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoComponents.swift
@@ -0,0 +1,404 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+/// The layout every shared-layout screen uses: a title, a form card and an optional footer, over
+/// the theme's background art.
+struct DemoPage: View {
+ /// `showsThemeMenu` is off for screens in their own sheet, such as reauthentication.
+ init(title: String?,
+ showsThemeMenu: Bool = true,
+ @ViewBuilder card: @escaping () -> Card,
+ @ViewBuilder footer: @escaping () -> Footer = { EmptyView() }) {
+ self.title = title
+ self.showsThemeMenu = showsThemeMenu
+ self.card = card
+ self.footer = footer
+ }
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ private let title: String?
+ private let showsThemeMenu: Bool
+ private let card: () -> Card
+ private let footer: () -> Footer
+
+ var body: some View {
+ let theme = themeID.theme
+ // The background is its own layer, so it fills the sheet whatever size the scroll view takes.
+ ZStack {
+ DemoThemeBackground(theme: theme)
+ ScrollView {
+ VStack(spacing: 0) {
+ if theme.id == .spark {
+ SparkHeadline()
+ // "headline" ends at y 135 and "inputs" starts at y 200.
+ .padding(.bottom, title == nil ? 65 : 24)
+ }
+ VStack(alignment: .leading, spacing: theme.titleSpacing) {
+ if let title {
+ Text(title)
+ .font(theme.title.font(relativeTo: .title))
+ .foregroundStyle(theme.title.color)
+ // Long titles wrap before the 83-point mascot and its 8.6-point inset.
+ .padding(.trailing, theme.id == .doggo ? 92 : 0)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .accessibilityAddTraits(.isHeader)
+ .accessibilityIdentifier("title")
+ }
+ DemoCard(theme: theme, content: card)
+ }
+ .overlay(alignment: .topTrailing) {
+ if theme.id == .doggo, title != nil {
+ // "doggo" ends 8.6 points inside the form's trailing edge (x 372.4 against 381) and
+ // starts 10.7 points above the title (y 163.3 against 174).
+ Image("FullCustomization/doggo-mascot")
+ .offset(x: -8.6, y: -10.7)
+ .accessibilityHidden(true)
+ .accessibilityIdentifier("doggo")
+ }
+ }
+ .demoContentWidth()
+ footer()
+ // With the switch row's 12-point inset, its text sits 24 points below the form.
+ .padding(.top, 12)
+ }
+ // Full width, so the whole sheet scrolls while the form stays centred.
+ .frame(maxWidth: .infinity)
+ .padding(.top, 16)
+ .padding(.bottom, 24)
+ }
+ .scrollBounceBehavior(.basedOnSize)
+ }
+ .navigationTitle("")
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar {
+ if showsThemeMenu {
+ ToolbarItem(placement: .topBarLeading) {
+ DemoThemeMenu()
+ }
+ }
+ }
+ }
+}
+
+/// The Coffee Spark headline.
+private struct SparkHeadline: View {
+ var body: some View {
+ HStack(spacing: 10) {
+ // Material Symbols "coffee".
+ Image(systemName: "cup.and.saucer")
+ .scaledSystemFont(size: 20, weight: .medium)
+ Text("Coffee Spark")
+ .font(.custom("JetBrainsMono-Medium", size: 20, relativeTo: .title3))
+ }
+ .foregroundStyle(Color(demoHex: 0x1C1B1B))
+ .padding(.horizontal, 16)
+ .frame(minHeight: 48)
+ .background(.white, in: RoundedRectangle(cornerRadius: 24))
+ .accessibilityElement(children: .combine)
+ .accessibilityIdentifier("headline")
+ }
+}
+
+/// The form card: a 16-point stack, drawn as a card with a hard offset shadow in Doggo.
+private struct DemoCard: View {
+ let theme: DemoTheme
+ let content: () -> Content
+
+ var body: some View {
+ let shape = RoundedRectangle(cornerRadius: theme.cardCornerRadius)
+ VStack(alignment: .leading, spacing: 16, content: content)
+ .padding(theme.cardPadding)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background {
+ if let fill = theme.cardFill {
+ shape.fill(fill)
+ }
+ }
+ .overlay {
+ if let stroke = theme.cardStroke {
+ shape.strokeBorder(stroke.color, lineWidth: stroke.width)
+ }
+ }
+ .hardShadow(theme.cardShadow, shape: shape)
+ .accessibilityElement(children: .contain)
+ .accessibilityIdentifier("inputs")
+ }
+}
+
+extension View {
+ /// The width every demo screen's content takes: inset 32 points from the sheet's edges, and
+ /// no wider than 480 points so it doesn't stretch on iPad. Narrower than the designs'
+ /// 49-point inset, which left too little room on phones.
+ func demoContentWidth() -> some View {
+ frame(maxWidth: 480)
+ .padding(.horizontal, 32)
+ }
+
+ /// A drop shadow with zero blur: an offset copy of the shape drawn behind the view.
+ @ViewBuilder
+ func hardShadow(_ shadow: DemoTheme.Shadow?, shape: some Shape) -> some View {
+ if let shadow {
+ background {
+ shape.fill(shadow.color).offset(x: shadow.x, y: shadow.y)
+ }
+ } else {
+ self
+ }
+ }
+
+ func demoText(_ token: DemoTheme.TextToken,
+ relativeTo style: Font.TextStyle = .body) -> some View {
+ Group {
+ if token.fontName == nil {
+ scaledSystemFont(size: token.size, weight: token.weight, relativeTo: style)
+ } else {
+ font(token.font(relativeTo: style))
+ }
+ }
+ .foregroundStyle(token.color)
+ .underline(token.underline)
+ }
+
+ /// The system font at a design size that still scales with Dynamic Type, which
+ /// `Font.system(size:weight:)` alone doesn't.
+ func scaledSystemFont(size: CGFloat,
+ weight: Font.Weight = .regular,
+ design: Font.Design = .default,
+ relativeTo style: Font.TextStyle = .body) -> some View {
+ modifier(ScaledSystemFont(size: size, weight: weight, design: design, relativeTo: style))
+ }
+}
+
+private struct ScaledSystemFont: ViewModifier {
+ @ScaledMetric private var size: CGFloat
+ let weight: Font.Weight
+ let design: Font.Design
+
+ init(size: CGFloat, weight: Font.Weight, design: Font.Design, relativeTo style: Font.TextStyle) {
+ _size = ScaledMetric(wrappedValue: size, relativeTo: style)
+ self.weight = weight
+ self.design = design
+ }
+
+ func body(content: Content) -> some View {
+ content.font(.system(size: size, weight: weight, design: design))
+ }
+}
+
+/// A text field 56 points tall with a 48-point leading icon slot. `icon` is an SF Symbol
+/// standing in for the design's Material Symbols glyph.
+struct DemoTextField: View {
+ var icon: String?
+ let placeholder: String
+ @Binding var text: String
+ var isSecure = false
+ var keyboard: UIKeyboardType = .default
+ var contentType: UITextContentType?
+ var identifier: String
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+ @State private var isRevealed = false
+
+ var body: some View {
+ let theme = themeID.theme
+ let shape = RoundedRectangle(cornerRadius: theme.fieldCornerRadius)
+ HStack(spacing: 0) {
+ if let icon {
+ Image(systemName: icon)
+ .font(.system(size: 20, weight: theme.fieldIconWeight))
+ .foregroundStyle(theme.fieldIcon)
+ .frame(width: 48, height: 48)
+ }
+ Group {
+ if isSecure, !isRevealed {
+ SecureField(text: $text) { placeholderText(theme) }
+ } else {
+ TextField(text: $text) { placeholderText(theme) }
+ }
+ }
+ .font(theme.fieldText.font())
+ .foregroundStyle(theme.fieldText.color)
+ .tint(theme.fieldText.color)
+ .keyboardType(keyboard)
+ .textContentType(contentType)
+ .textInputAutocapitalization(.never)
+ .autocorrectionDisabled()
+ .padding(.leading, icon == nil ? 16 : 0)
+ .accessibilityIdentifier(identifier)
+ if isSecure {
+ Button {
+ isRevealed.toggle()
+ } label: {
+ Image(systemName: isRevealed ? "eye" : "eye.slash")
+ .foregroundStyle(theme.fieldTrailingIcon)
+ .frame(width: 48, height: 48)
+ }
+ .accessibilityLabel(isRevealed ? "Hide password" : "Show password")
+ .accessibilityIdentifier("trailing-icon")
+ }
+ }
+ .padding(.vertical, 4)
+ .padding(.trailing, isSecure ? 0 : 16)
+ .frame(minHeight: 56)
+ .background(theme.fieldFill, in: shape)
+ .overlay {
+ shape.strokeBorder(theme.fieldStroke.color, lineWidth: theme.fieldStroke.width)
+ }
+ }
+
+ private func placeholderText(_ theme: DemoTheme) -> Text {
+ Text(placeholder).foregroundStyle(theme.fieldPlaceholder)
+ }
+}
+
+/// A button 64 points tall and as wide as the form.
+struct DemoButton: View {
+ enum Kind {
+ case primary
+ case secondary
+ }
+
+ let title: String
+ var kind: Kind = .primary
+ var isLoading = false
+ var identifier: String
+ let action: () -> Void
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+ @Environment(\.isEnabled) private var isEnabled
+
+ var body: some View {
+ let theme = themeID.theme
+ let colors = kind == .primary ? theme.primaryButton : theme.secondaryButton
+ let shape = RoundedRectangle(cornerRadius: theme.buttonCornerRadius)
+ Button(action: action) {
+ ZStack {
+ Text(title)
+ .font(theme.buttonFont.font(relativeTo: .title3))
+ .opacity(isLoading ? 0 : 1)
+ if isLoading {
+ ProgressView().tint(colors.label)
+ }
+ }
+ .foregroundStyle(colors.label)
+ .padding(.horizontal, 24)
+ .frame(maxWidth: .infinity, minHeight: theme.buttonHeight)
+ .background(colors.fill, in: shape)
+ .overlay {
+ if let stroke = theme.buttonStroke {
+ shape.strokeBorder(stroke.color, lineWidth: stroke.width)
+ }
+ }
+ .hardShadow(theme.buttonShadow, shape: shape)
+ // Composited first, so the shadow doesn't show through the faded fill.
+ .compositingGroup()
+ .opacity(isEnabled ? 1 : 0.5)
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// A text link in the theme's link style.
+struct DemoLink: View {
+ let title: String
+ var alignment: Alignment = .trailing
+ var identifier: String
+ let action: () -> Void
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+ @Environment(\.isEnabled) private var isEnabled
+
+ private var textAlignment: TextAlignment {
+ switch alignment {
+ case .center: .center
+ case .trailing: .trailing
+ default: .leading
+ }
+ }
+
+ var body: some View {
+ Button(action: action) {
+ Text(title)
+ .demoText(themeID.theme.link)
+ .multilineTextAlignment(textAlignment)
+ .opacity(isEnabled ? 1 : 0.5)
+ // A taller tap area than the text, without changing the layout.
+ .padding(.vertical, 8)
+ .contentShape(Rectangle())
+ .padding(.vertical, -8)
+ }
+ .buttonStyle(.plain)
+ .frame(maxWidth: .infinity, alignment: alignment)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// Supporting copy on the screens the designs don't cover, in the "Other sign in methods" style.
+struct DemoBodyText: View {
+ let text: String
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ init(_ text: String) {
+ self.text = text
+ }
+
+ var body: some View {
+ Text(text)
+ .demoText(themeID.theme.body)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+}
+
+/// A slot's `errorMessage`, set in the library's typography with `.authFont(_:weight:)`.
+struct DemoErrorText: View {
+ let message: String?
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ if let message {
+ Text(message)
+ .authFont(.footnote)
+ .foregroundStyle(themeID.theme.errorColor)
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityIdentifier("error-message")
+ }
+ }
+}
+
+/// Switches the demo's theme live from any screen, like the web demo's switcher.
+struct DemoThemeMenu: View {
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ Menu {
+ Picker("Theme", selection: $themeID) {
+ ForEach(DemoThemeID.allCases) { theme in
+ Text(theme.label).tag(theme)
+ }
+ }
+ } label: {
+ Image(systemName: "paintpalette")
+ .foregroundStyle(.primary)
+ }
+ .accessibilityLabel("Theme")
+ .accessibilityIdentifier("theme-switcher")
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoEmailAndPhoneScreens.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoEmailAndPhoneScreens.swift
new file mode 100644
index 00000000000..ed91017f320
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoEmailAndPhoneScreens.swift
@@ -0,0 +1,233 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+// The original designs don't cover these screens; their copy and structure follow the
+// FirebaseUI-Android full customization demo, restyled with the theme's Landing values.
+
+struct DemoPasswordRecovery: View {
+ var body: some View {
+ PasswordRecoveryScreen { state in
+ if state.didSend {
+ DemoPage(title: "Check your inbox") {
+ DemoBodyText("Reset link sent! Follow the link we sent to \(state.sentEmail).")
+ DemoButton(
+ title: "Back to login",
+ identifier: "back-to-login-button",
+ action: state.dismissSuccess
+ )
+ }
+ } else {
+ DemoPage(title: "Reset password") {
+ DemoBodyText("Enter your email address and we'll send you a link to reset it.")
+ DemoTextField(
+ icon: "at",
+ placeholder: "Email address",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Send reset link",
+ isLoading: state.isLoading,
+ identifier: "send-reset-link-button",
+ action: state.sendResetLink
+ )
+ .disabled(!state.isValid)
+ }
+ }
+ }
+ }
+}
+
+struct DemoEmailLink: View {
+ var body: some View {
+ EmailLinkScreen { state in
+ if state.needsEmailConfirmation {
+ // The link was opened on a device that didn't request it.
+ DemoPage(title: "Confirm your email") {
+ DemoBodyText("Enter the email address the sign-in link was sent to.")
+ DemoTextField(
+ icon: "at",
+ placeholder: "Email address",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Sign in",
+ isLoading: state.isLoading,
+ identifier: "confirm-email-button",
+ action: state.confirmEmail
+ )
+ .disabled(!state.isValid)
+ DemoLink(
+ title: "Send a new link instead",
+ alignment: .leading,
+ identifier: "cancel-confirmation-button",
+ action: state.cancelConfirmation
+ )
+ .disabled(state.isLoading)
+ }
+ } else if state.didSend {
+ DemoPage(title: "Check your inbox") {
+ DemoBodyText("Login link sent! Open it to sign in as \(state.email.wrappedValue).")
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Use a different email",
+ kind: .secondary,
+ isLoading: state.isLoading,
+ identifier: "different-email-button",
+ action: state.dismissAlert
+ )
+ }
+ } else {
+ DemoPage(title: "Email link sign-in") {
+ DemoBodyText("We'll email you a link that signs you in, no password needed.")
+ DemoTextField(
+ icon: "at",
+ placeholder: "Email address",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Send login link",
+ isLoading: state.isLoading,
+ identifier: "send-login-link-button",
+ action: state.sendSignInLink
+ )
+ .disabled(!state.isValid)
+ }
+ }
+ }
+ }
+}
+
+struct DemoEnterPhoneNumber: View {
+ var body: some View {
+ EnterPhoneNumberScreen { state in
+ DemoPage(title: "Login by phone number") {
+ DemoPhoneNumberField(phoneNumber: state.phoneNumber, country: state.selectedCountry)
+ DemoBodyText(
+ "By signing in with phone number, an SMS may be sent. Message & data rates may apply."
+ )
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ .disabled(!state.isValid)
+ }
+ }
+ }
+}
+
+struct DemoEnterVerificationCode: View {
+ let verificationID: String
+ let fullPhoneNumber: String
+
+ var body: some View {
+ EnterVerificationCodeScreen(
+ verificationID: verificationID,
+ fullPhoneNumber: fullPhoneNumber
+ ) { state in
+ DemoPage(title: "Enter your code") {
+ DemoBodyText("We sent a code to \(state.fullPhoneNumber).")
+ DemoCodeField(code: state.verificationCode, identifier: "verification-code-field")
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ DemoLink(
+ title: state.resendCountdown > 0
+ ? "Resend code in \(state.resendCountdown)s"
+ : "Resend code",
+ alignment: .leading,
+ identifier: "resend-code-button",
+ action: state.resendCode
+ )
+ .disabled(state.resendCountdown > 0 || state.isLoading)
+ DemoLink(
+ title: "Use a different number",
+ alignment: .leading,
+ identifier: "change-number-button",
+ action: state.changeNumber
+ )
+ }
+ }
+ }
+}
+
+/// The library's `CountrySelector` inside a demo text field's frame, tinted with the field text.
+struct DemoPhoneNumberField: View {
+ let phoneNumber: Binding
+ let country: Binding
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ let theme = themeID.theme
+ let shape = RoundedRectangle(cornerRadius: theme.fieldCornerRadius)
+ HStack(spacing: 8) {
+ CountrySelector(selectedCountry: country)
+ .tint(theme.fieldText.color)
+ .font(theme.fieldText.font())
+ .accessibilityIdentifier("country-selector")
+ TextField(text: phoneNumber) {
+ Text("Phone number").foregroundStyle(theme.fieldPlaceholder)
+ }
+ .font(theme.fieldText.font())
+ .foregroundStyle(theme.fieldText.color)
+ .keyboardType(.phonePad)
+ .textContentType(.telephoneNumber)
+ .accessibilityIdentifier("phone-number-field")
+ }
+ .padding(.horizontal, 16)
+ .frame(minHeight: 56)
+ .background(theme.fieldFill, in: shape)
+ .overlay { shape.strokeBorder(theme.fieldStroke.color, lineWidth: theme.fieldStroke.width) }
+ }
+}
+
+/// A one-time code in a demo text field.
+struct DemoCodeField: View {
+ let code: Binding
+ var identifier: String
+
+ var body: some View {
+ DemoTextField(
+ icon: "number",
+ placeholder: "6-digit code",
+ text: code,
+ keyboard: .numberPad,
+ contentType: .oneTimeCode,
+ identifier: identifier
+ )
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoLanding.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoLanding.swift
new file mode 100644
index 00000000000..d24fafeabe1
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoLanding.swift
@@ -0,0 +1,388 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import FirebaseOAuthSwiftUI
+import SwiftUI
+
+/// The whole signed-out first screen, from the themes' Landing designs. `EmailAuthScreen` drives
+/// the email form, and the provider buttons start sign-in through `AuthMethodPickerState`, so
+/// MFA, account conflicts and errors are routed the same as with the stock screen.
+struct DemoLanding: View {
+ let pickerState: AuthMethodPickerState
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ EmailAuthScreen { state in
+ DemoPage(title: title(for: state.flow)) {
+ emailForm(state)
+ } footer: {
+ DemoOtherSignInMethods(
+ pickerState: pickerState,
+ flow: state.flow,
+ showsFlowSwitch: pickerState.isEmailSignInEnabled && state.canSignUp,
+ switchFlow: state.switchFlow
+ )
+ }
+ }
+ }
+
+ private func title(for flow: AuthenticationFlow) -> String? {
+ guard themeID.theme.showsTitle else { return nil }
+ return flow == .signIn ? "Login" : "Sign up"
+ }
+
+ @ViewBuilder
+ private func emailForm(_ state: EmailAuthContentState) -> some View {
+ if pickerState.isEmailSignInEnabled {
+ DemoEmailFields(state: state)
+ }
+ if pickerState.isEmailLinkEnabled {
+ DemoButton(
+ title: "Email link sign-in",
+ kind: .secondary,
+ identifier: "email-link-button",
+ action: state.selectEmailLink
+ )
+ }
+ }
+}
+
+/// The email and password form for either flow, with a name field when sign-up needs one.
+struct DemoEmailFields: View {
+ let state: EmailAuthContentState
+
+ var body: some View {
+ if state.flow == .signUp, state.requiresDisplayName {
+ DemoTextField(
+ icon: "person",
+ placeholder: "Name",
+ text: state.displayName,
+ contentType: .name,
+ identifier: "name-field"
+ )
+ }
+ DemoTextField(
+ icon: "at",
+ placeholder: "Email address",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ DemoTextField(
+ icon: "ellipsis.rectangle",
+ placeholder: "Password",
+ text: state.password,
+ isSecure: true,
+ contentType: state.flow == .signIn ? .password : .newPassword,
+ identifier: "password-field"
+ )
+ if state.flow == .signUp {
+ DemoTextField(
+ icon: "ellipsis.rectangle",
+ placeholder: "Confirm password",
+ text: state.confirmPassword,
+ isSecure: true,
+ contentType: .newPassword,
+ identifier: "confirm-password-field"
+ )
+ }
+ DemoErrorText(message: state.errorMessage)
+ if state.flow == .signIn {
+ DemoLink(
+ title: "Forgot password?",
+ identifier: "forgot-password",
+ action: state.goToPasswordRecovery
+ )
+ }
+ DemoButton(
+ title: state.flow == .signIn ? "Login" : "Create account",
+ isLoading: state.isLoading,
+ identifier: "sign-in-button",
+ action: state.flow == .signIn ? state.signIn : state.signUp
+ )
+ .disabled(!state.isValid)
+ }
+}
+
+/// Sign-up on the `.signUp` route. The shared layout switches flows in place, so this only shows
+/// when the theme changes on Professional's pushed sign-up screen.
+struct DemoSignUp: View {
+ @Environment(\.dismiss) private var dismiss
+
+ var body: some View {
+ EmailAuthScreen(flow: .signUp) { state in
+ DemoPage(title: "Sign up") {
+ DemoEmailFields(state: state)
+ // The sign-in form is on the screen underneath, so go back to it.
+ DemoLink(
+ title: "Already have an account? Login",
+ alignment: .leading,
+ identifier: "sign-in-instead-button",
+ action: { dismiss() }
+ )
+ }
+ }
+ }
+}
+
+/// The other sign-in methods, the flow switch and the terms. Google and phone get the buttons
+/// from the design; any other registered provider is listed in a sheet.
+private struct DemoOtherSignInMethods: View {
+ let pickerState: AuthMethodPickerState
+ let flow: AuthenticationFlow
+ /// Off when email sign-in is disabled or new accounts aren't allowed.
+ let showsFlowSwitch: Bool
+ let switchFlow: () -> Void
+
+ @Environment(AuthService.self) private var authService
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+ @State private var isShowingOtherProviders = false
+ @State private var pendingProvider: AuthProviderUI?
+
+ private var google: AuthProviderUI? {
+ pickerState.providers.first { $0.id == "google.com" }
+ }
+
+ private var phone: AuthProviderUI? {
+ pickerState.providers.first { $0.id == "phone" }
+ }
+
+ private var otherProviders: [AuthProviderUI] {
+ pickerState.providers.filter { $0.id != "google.com" && $0.id != "phone" }
+ }
+
+ var body: some View {
+ let theme = themeID.theme
+ VStack(spacing: 0) {
+ // Not where the design has it: the sign-in / sign-up switch belongs to the email form, so it
+ // sits right below the form, above the other sign-in methods.
+ if showsFlowSwitch {
+ Button(action: switchFlow) {
+ flowSwitchText(theme)
+ .frame(minHeight: 44)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier("login")
+ }
+
+ VStack(spacing: 12) {
+ // As in the design, the label spans the frame's padding so it doesn't wrap.
+ Text("Other sign in methods")
+ .demoText(theme.otherLabel)
+ .lineLimit(1)
+ .padding(.horizontal, -theme.otherPadding.leading)
+ .accessibilityIdentifier("other-sign-in-methods")
+ if let google {
+ DemoProviderButton(
+ title: "Continue with Google",
+ fill: theme.pillFill,
+ label: theme.googleLabel,
+ stroke: theme.pillStroke,
+ cornerRadius: theme.pillCornerRadius,
+ identifier: "google-button"
+ ) {
+ Image("FullCustomization/google-g")
+ } action: {
+ pickerState.select(google)
+ }
+ }
+ if let phone {
+ DemoProviderButton(
+ title: "Sign in with phone",
+ fill: theme.phoneProvider.fill,
+ label: theme.phoneProvider.label,
+ cornerRadius: theme.phoneProvider.cornerRadius,
+ identifier: "phone-button"
+ ) {
+ // Material Symbols "phone".
+ Image(systemName: "phone")
+ .scaledSystemFont(size: 18, weight: .medium)
+ } action: {
+ pickerState.select(phone)
+ }
+ }
+ if !otherProviders.isEmpty {
+ // Not in the design: the remaining providers, behind a pill styled like Google's.
+ DemoProviderButton(
+ title: "More sign-in options",
+ fill: theme.pillFill,
+ label: theme.googleLabel,
+ stroke: theme.pillStroke,
+ cornerRadius: theme.pillCornerRadius,
+ identifier: "other-providers-button"
+ ) {
+ Image(systemName: "ellipsis.circle")
+ .scaledSystemFont(size: 18, weight: .medium)
+ } action: {
+ isShowingOtherProviders = true
+ }
+ }
+ }
+ .padding(theme.otherPadding)
+ .overlay(alignment: .top) {
+ // A 4-point top stroke centred on the frame edge, so the inner 2 points show.
+ Rectangle()
+ .fill(theme.dividerColor)
+ .frame(height: 2)
+ }
+ .accessibilityElement(children: .contain)
+ .accessibilityIdentifier("other")
+ // With the switch row's 12-point inset, the divider sits 24 points below the switch text,
+ // the same as the gap above it.
+ .padding(.top, 12)
+
+ termsText(theme)
+ .padding(.top, 24)
+ }
+ .demoContentWidth()
+ // Sign-in starts once the sheet is gone, so a provider that presents its own screen
+ // (such as an OAuth web view) isn't presented from a sheet that is animating away.
+ .sheet(isPresented: $isShowingOtherProviders, onDismiss: {
+ if let provider = pendingProvider {
+ pendingProvider = nil
+ pickerState.select(provider)
+ }
+ }) {
+ DemoOtherProvidersSheet(providers: otherProviders) { provider in
+ pendingProvider = provider
+ isShowingOtherProviders = false
+ }
+ .presentationDetents([.medium, .large])
+ }
+ }
+
+ private func flowSwitchText(_ theme: DemoTheme) -> Text {
+ let prompt = flow == .signIn ? "Don't have an account? " : "Already have an account? "
+ let action = flow == .signIn ? "Sign up" : "Login"
+ return Text(prompt)
+ .font(theme.footerText.font())
+ .foregroundColor(theme.footerText.color)
+ + Text(action)
+ .font(theme.footerAccent.font())
+ .foregroundColor(theme.footerAccent.color)
+ .underline(theme.footerAccent.underline)
+ }
+
+ /// The library's `PrivacyTOCsView` is internal, so a whole custom first screen draws its own
+ /// terms copy from the configured URLs.
+ @ViewBuilder
+ private func termsText(_ theme: DemoTheme) -> some View {
+ let configuration = authService.configuration
+ if let tosUrl = configuration.tosUrl, let privacyPolicyUrl = configuration.privacyPolicyUrl,
+ let terms = try? AttributedString(markdown: """
+ By continuing, you agree to the [Terms of Service](\(tosUrl.absoluteString)) \
+ and [Privacy Policy](\(privacyPolicyUrl.absoluteString)).
+ """) {
+ Text(terms)
+ .font(theme.footerText.font(relativeTo: .footnote))
+ .foregroundStyle(theme.footerText.color)
+ .tint(theme.footerAccent.color)
+ .multilineTextAlignment(.center)
+ .accessibilityIdentifier("terms")
+ }
+ }
+}
+
+/// A 52-point pill with a 20-point icon and a label.
+private struct DemoProviderButton: View {
+ let title: String
+ let fill: Color
+ let label: DemoTheme.TextToken
+ var stroke: Color?
+ let cornerRadius: CGFloat
+ var identifier: String
+ @ViewBuilder let icon: () -> Icon
+ let action: () -> Void
+
+ var body: some View {
+ let shape = RoundedRectangle(cornerRadius: cornerRadius)
+ Button(action: action) {
+ HStack(spacing: 12) {
+ icon()
+ .frame(width: 20, height: 20)
+ Text(title)
+ .font(label.font(relativeTo: .subheadline))
+ .tracking(0.1)
+ .lineLimit(1)
+ .minimumScaleFactor(0.8)
+ }
+ .foregroundStyle(label.color)
+ .padding(16)
+ .frame(maxWidth: .infinity, minHeight: 52, alignment: .leading)
+ .background(fill, in: shape)
+ .overlay {
+ if let stroke {
+ shape.strokeBorder(stroke, lineWidth: 1)
+ }
+ }
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// The registered providers the designs don't draw, as the library's own brand buttons.
+/// `AuthProviderButton` takes the demo's action, so sign-in still goes through
+/// `AuthMethodPickerState.select` once the sheet has closed.
+struct DemoOtherProvidersSheet: View {
+ let providers: [AuthProviderUI]
+ let select: (AuthProviderUI) -> Void
+
+ @Environment(AuthService.self) private var authService
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ let theme = themeID.theme
+ ScrollView {
+ VStack(spacing: 16) {
+ Text("Other sign in methods")
+ .demoText(theme.otherLabel)
+ .padding(.bottom, 4)
+ ForEach(providers, id: \.id) { provider in
+ let button = stockButton(for: provider)
+ AuthProviderButton(
+ label: button.label,
+ style: button.style,
+ accessibilityId: "\(provider.id)-button"
+ ) {
+ select(provider)
+ }
+ }
+ }
+ .demoContentWidth()
+ .padding(.vertical, 32)
+ .frame(maxWidth: .infinity)
+ }
+ .background { DemoThemeBackground(theme: theme) }
+ }
+
+ /// The label and style the provider's stock button uses.
+ private func stockButton(for provider: AuthProviderUI) -> (label: String, style: ProviderStyle) {
+ if let oauth = provider.provider as? OAuthProviderSwift {
+ return (oauth.buttonLabel, ProviderStyle(
+ icon: oauth.buttonIcon,
+ backgroundColor: oauth.buttonBackgroundColor,
+ contentColor: oauth.buttonForegroundColor
+ ))
+ }
+ if provider.id == "apple.com" {
+ return (authService.string.appleLoginButtonLabel, .apple)
+ }
+ return ("Sign in with \(provider.displayName)", .empty)
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoReauthScreens.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoReauthScreens.swift
new file mode 100644
index 00000000000..8e668d5a380
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoReauthScreens.swift
@@ -0,0 +1,250 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+// The reauthentication prompts, given to `.reauthContent`. The library still presents them as
+// sheets when a sensitive action (deleting the account, changing the password, managing
+// two-factor) needs a recent sign-in, and still verifies the user and reports errors. Neither the
+// original designs nor the Android demo draw them, so they reuse each theme's own screen pieces.
+
+/// The reauthentication prompt for the selected theme.
+struct ThemedReauth: View {
+ let prompt: ReauthPrompt
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ if themeID == .professional {
+ ProReauth(prompt: prompt)
+ } else {
+ DemoReauth(prompt: prompt)
+ }
+ }
+}
+
+/// The shared-layout themes' reauthentication prompt.
+private struct DemoReauth: View {
+ let prompt: ReauthPrompt
+
+ var body: some View {
+ switch prompt {
+ case let .password(state):
+ DemoPage(title: "Confirm it's you", showsThemeMenu: false) {
+ DemoBodyText("Enter the password for \(state.email) to continue.")
+ DemoTextField(
+ icon: "ellipsis.rectangle",
+ placeholder: "Password",
+ text: state.password,
+ isSecure: true,
+ contentType: .password,
+ identifier: "reauth-password-field"
+ )
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Continue",
+ isLoading: state.isLoading,
+ identifier: "reauth-verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ DemoLink(
+ title: "Cancel",
+ alignment: .leading,
+ identifier: "reauth-cancel-button",
+ action: state.cancel
+ )
+ }
+ case let .phone(state):
+ DemoPage(title: "Confirm it's you", showsThemeMenu: false) {
+ DemoBodyText(state.codeSent
+ ? "We sent a code to \(state.phoneNumber)."
+ : "We'll text a code to \(state.phoneNumber) to confirm it's you.")
+ if state.codeSent {
+ DemoCodeField(code: state.verificationCode, identifier: "reauth-code-field")
+ }
+ DemoErrorText(message: state.errorMessage)
+ if state.codeSent {
+ DemoButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "reauth-verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ DemoLink(
+ title: "Resend code",
+ alignment: .leading,
+ identifier: "reauth-resend-button",
+ action: state.sendCode
+ )
+ .disabled(state.isLoading)
+ } else {
+ DemoButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "reauth-send-code-button",
+ action: state.sendCode
+ )
+ }
+ DemoLink(
+ title: "Cancel",
+ alignment: .leading,
+ identifier: "reauth-cancel-button",
+ action: state.cancel
+ )
+ }
+ case let .emailLink(state):
+ DemoPage(title: "Check your inbox", showsThemeMenu: false) {
+ DemoBodyText(state.linkSent
+ ? "We sent a sign-in link to \(state.email). Open it on this device to continue."
+ : "Sending a sign-in link to \(state.email).")
+ DemoErrorText(message: state.errorMessage)
+ DemoButton(
+ title: "Resend link",
+ kind: .secondary,
+ isLoading: state.isLoading,
+ identifier: "reauth-resend-button",
+ action: state.resendLink
+ )
+ DemoLink(
+ title: "Cancel",
+ alignment: .leading,
+ identifier: "reauth-cancel-button",
+ action: state.cancel
+ )
+ }
+ // Later releases may add prompts for new providers.
+ @unknown default:
+ DefaultReauthContent(prompt: prompt)
+ }
+ }
+}
+
+/// The Professional reauthentication prompt, in its own layout.
+private struct ProReauth: View {
+ let prompt: ReauthPrompt
+
+ var body: some View {
+ switch prompt {
+ case let .password(state):
+ ProPage(showsThemeMenu: false) {
+ ProHeader(
+ symbol: "lock",
+ title: "Confirm it's you",
+ subtitle: "For your security, enter the password for \(state.email) to continue."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Password",
+ placeholder: "Enter your password",
+ text: state.password,
+ isSecure: true,
+ contentType: .password,
+ identifier: "reauth-password-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Continue",
+ isLoading: state.isLoading,
+ identifier: "reauth-verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ ProTextButton(title: "Cancel", identifier: "reauth-cancel-button", action: state.cancel)
+ .padding(.top, 4)
+ }
+ case let .phone(state):
+ ProPage(showsThemeMenu: false) {
+ ProHeader(
+ symbol: "phone",
+ title: "Confirm it's you",
+ subtitle: state.codeSent
+ ? "Enter the 6-digit code we sent to \(state.phoneNumber)."
+ : "For your security, we'll text a code to \(state.phoneNumber)."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ if state.codeSent {
+ ProField(
+ label: "Verification code",
+ placeholder: "6-digit code",
+ text: state.verificationCode,
+ keyboard: .numberPad,
+ contentType: .oneTimeCode,
+ identifier: "reauth-code-field"
+ )
+ }
+ ProErrorText(message: state.errorMessage)
+ if state.codeSent {
+ ProPrimaryButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "reauth-verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ } else {
+ ProPrimaryButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "reauth-send-code-button",
+ action: state.sendCode
+ )
+ .padding(.top, 4)
+ }
+ }
+ if state.codeSent {
+ ProTextButton(
+ title: "Resend code",
+ identifier: "reauth-resend-button",
+ action: state.sendCode
+ )
+ .disabled(state.isLoading)
+ .padding(.top, 4)
+ }
+ ProTextButton(title: "Cancel", identifier: "reauth-cancel-button", action: state.cancel)
+ }
+ case let .emailLink(state):
+ ProPage(showsThemeMenu: false) {
+ ProHeader(
+ symbol: "envelope.badge",
+ title: "Check your inbox",
+ subtitle: state.linkSent
+ ? "We sent a sign-in link to \(state.email). Open it on this device to continue."
+ : "Sending a sign-in link to \(state.email)."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ ProErrorText(message: state.errorMessage)
+ ProTextButton(
+ title: "Resend link",
+ identifier: "reauth-resend-button",
+ action: state.resendLink
+ )
+ .disabled(state.isLoading)
+ ProTextButton(title: "Cancel", identifier: "reauth-cancel-button", action: state.cancel)
+ }
+ }
+ // Later releases may add prompts for new providers.
+ @unknown default:
+ DefaultReauthContent(prompt: prompt)
+ }
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoTheme.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoTheme.swift
new file mode 100644
index 00000000000..41915ec07d3
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/DemoTheme.swift
@@ -0,0 +1,489 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+/// The looks of the full customization demo. Doggo, Grid and Coffee Spark share one layout and
+/// come from their iOS Landing designs; screens the designs don't cover reuse their values.
+/// Professional has its own layout, and its values are a written spec in
+/// ``DemoTheme/professional``.
+enum DemoThemeID: String, CaseIterable, Identifiable {
+ case doggo
+ case grid
+ case spark
+ case professional
+
+ static let storageKey = "fullCustomization.theme"
+
+ var id: String { rawValue }
+
+ var label: String {
+ switch self {
+ case .doggo: "Doggo"
+ case .grid: "Grid"
+ case .spark: "Coffee Spark"
+ case .professional: "Professional"
+ }
+ }
+
+ var theme: DemoTheme {
+ switch self {
+ case .doggo: .doggo
+ case .grid: .grid
+ case .spark: .spark
+ case .professional: .professional
+ }
+ }
+
+ /// Doggo, Grid and Coffee Spark come from light designs with fixed colours, so they stay
+ /// light; Professional has light and dark variants and follows the system.
+ var colorScheme: ColorScheme? {
+ self == .professional ? nil : .light
+ }
+}
+
+struct DemoTheme {
+ struct TextToken {
+ /// A bundled font's PostScript name, or `nil` for the system font at ``weight``.
+ var fontName: String?
+ var size: CGFloat
+ var weight: Font.Weight = .regular
+ var color: Color
+ var underline = false
+
+ func font(relativeTo style: Font.TextStyle = .body) -> Font {
+ if let fontName {
+ .custom(fontName, size: size, relativeTo: style)
+ } else {
+ .system(size: size, weight: weight)
+ }
+ }
+ }
+
+ struct ButtonColors {
+ var fill: Color
+ var label: Color
+ }
+
+ struct Shadow {
+ var color: Color
+ var x: CGFloat
+ var y: CGFloat
+ }
+
+ struct Stroke {
+ var color: Color
+ var width: CGFloat
+ }
+
+ struct Provider {
+ var fill: Color
+ var label: DemoTheme.TextToken
+ var cornerRadius: CGFloat
+ }
+
+ let id: DemoThemeID
+ /// The family handed to `AuthTypography`, so library screens the demo doesn't replace (update
+ /// password, reauthentication, delete confirmation) use the theme's font too. `nil` keeps the
+ /// system font.
+ let libraryFontFamily: String?
+ let pageBackground: Color
+
+ /// The "title" text above the form. Coffee Spark hides it and shows ``headline``.
+ let title: TextToken
+ let showsTitle: Bool
+ /// Space between the title and the form: the "sign up" frame's title-to-inputs offset.
+ let titleSpacing: CGFloat
+
+ /// The "inputs" frame: Doggo draws it as a card; Grid and Coffee Spark leave it bare.
+ let cardFill: Color?
+ let cardCornerRadius: CGFloat
+ let cardPadding: CGFloat
+ let cardShadow: Shadow?
+ let cardStroke: Stroke?
+
+ /// The "text-field" instance.
+ let fieldFill: Color
+ let fieldStroke: Stroke
+ let fieldCornerRadius: CGFloat
+ let fieldText: TextToken
+ let fieldPlaceholder: Color
+ let fieldIcon: Color
+ let fieldIconWeight: Font.Weight
+ let fieldTrailingIcon: Color
+
+ let link: TextToken
+
+ /// The "button" instances: primary is "Login", secondary is "Email link sign-in".
+ let buttonFont: TextToken
+ let buttonCornerRadius: CGFloat
+ let buttonHeight: CGFloat
+ let buttonStroke: Stroke?
+ let buttonShadow: Shadow?
+ let primaryButton: ButtonColors
+ let secondaryButton: ButtonColors
+
+ /// The "Content" frame below the form.
+ let dividerColor: Color
+ let otherLabel: TextToken
+ let otherPadding: EdgeInsets
+ let googleLabel: TextToken
+ /// The Google and "More sign-in options" pills.
+ let pillFill: Color
+ let pillCornerRadius: CGFloat
+ let pillStroke: Color
+ let phoneProvider: Provider
+ let footerText: TextToken
+ let footerAccent: TextToken
+
+ let errorColor = Color(demoHex: 0xBA1A1A)
+
+ var body: TextToken { otherLabel }
+}
+
+extension DemoTheme {
+ /// Doggo: pastel background art and offset-shadow cards.
+ static let doggo = DemoTheme(
+ id: .doggo,
+ libraryFontFamily: "Onest",
+ pageBackground: Color(demoHex: 0xFFF8F8),
+ title: TextToken(fontName: "BagelFatOne-Regular", size: 28, color: Color(demoHex: 0x864B6F)),
+ showsTitle: true,
+ titleSpacing: 12,
+ cardFill: Color(demoHex: 0xFFF8F8),
+ cardCornerRadius: 24,
+ cardPadding: 16,
+ cardShadow: Shadow(color: Color(demoHex: 0xFFD8EB), x: 3, y: 6),
+ cardStroke: nil,
+ fieldFill: .white,
+ fieldStroke: Stroke(color: Color(demoHex: 0xD3C2C9), width: 1),
+ fieldCornerRadius: 24,
+ fieldText: TextToken(fontName: "Onest-Medium", size: 16, color: Color(demoHex: 0x211A1D)),
+ fieldPlaceholder: Color(demoHex: 0xA08B95),
+ fieldIcon: Color(demoHex: 0xA08B95),
+ fieldIconWeight: .bold,
+ fieldTrailingIcon: Color(demoHex: 0x49454F),
+ link: TextToken(
+ fontName: "Onest-Medium",
+ size: 16,
+ color: Color(demoHex: 0x864B6F),
+ underline: true
+ ),
+ buttonFont: TextToken(fontName: "Onest-Bold", size: 20, color: .white),
+ buttonCornerRadius: 36,
+ buttonHeight: 64,
+ buttonStroke: nil,
+ buttonShadow: Shadow(color: Color(demoHex: 0x5D0B47), x: 2, y: 4),
+ primaryButton: ButtonColors(fill: Color(demoHex: 0x864B6F), label: .white),
+ secondaryButton: ButtonColors(fill: Color(demoHex: 0xFFD8EB), label: Color(demoHex: 0x7B3B73)),
+ dividerColor: Color(demoHex: 0x864B6F),
+ otherLabel: TextToken(fontName: "Onest-Medium", size: 16, color: Color(demoHex: 0xA08B95)),
+ otherPadding: EdgeInsets(top: 16, leading: 40, bottom: 0, trailing: 40),
+ googleLabel: TextToken(fontName: "Roboto-SemiBold", size: 14, color: .black),
+ pillFill: .white,
+ pillCornerRadius: 80,
+ pillStroke: .black,
+ phoneProvider: Provider(
+ fill: Color(demoHex: 0x894680),
+ label: TextToken(fontName: "Roboto-Medium", size: 14, color: .white),
+ cornerRadius: 80
+ ),
+ footerText: TextToken(fontName: "Onest-Medium", size: 14, color: Color(demoHex: 0x202124)),
+ footerAccent: TextToken(fontName: "Onest-Bold", size: 14, color: Color(demoHex: 0x894680))
+ )
+
+ /// Grid: the grid background.
+ static let grid = DemoTheme(
+ id: .grid,
+ libraryFontFamily: "Chivo Mono",
+ pageBackground: Color(demoHex: 0xF3FBFB),
+ title: TextToken(fontName: "Rowdies-Regular", size: 28, color: Color(demoHex: 0x2C1067)),
+ showsTitle: true,
+ titleSpacing: 12,
+ cardFill: nil,
+ cardCornerRadius: 24,
+ cardPadding: 0,
+ cardShadow: nil,
+ cardStroke: nil,
+ fieldFill: .white,
+ fieldStroke: Stroke(color: Color(demoHex: 0x00DCE2), width: 2),
+ fieldCornerRadius: 16,
+ fieldText: TextToken(fontName: "ChivoMono-Medium", size: 16, color: Color(demoHex: 0x2C1067)),
+ fieldPlaceholder: Color(demoHex: 0x2C1067),
+ fieldIcon: Color(demoHex: 0x2C1067),
+ fieldIconWeight: .regular,
+ fieldTrailingIcon: Color(demoHex: 0x2C1067),
+ link: TextToken(fontName: "ChivoMono-Medium", size: 16, color: Color(demoHex: 0xFF52B3)),
+ buttonFont: TextToken(fontName: "Rowdies-Bold", size: 20, color: Color(demoHex: 0x2C1067)),
+ buttonCornerRadius: 24,
+ buttonHeight: 64,
+ buttonStroke: Stroke(color: Color(demoHex: 0x00DCE2), width: 2),
+ buttonShadow: Shadow(color: Color(demoHex: 0x00DCE2), x: 3, y: 6),
+ primaryButton: ButtonColors(fill: Color(demoHex: 0xFF52B3), label: Color(demoHex: 0x2C1067)),
+ secondaryButton: ButtonColors(fill: Color(demoHex: 0xF3FBFB), label: Color(demoHex: 0x2C1067)),
+ dividerColor: Color(demoHex: 0x864B6F),
+ otherLabel: TextToken(fontName: "ChivoMono-Medium", size: 16, color: Color(demoHex: 0x2C1067)),
+ otherPadding: EdgeInsets(top: 16, leading: 40, bottom: 0, trailing: 40),
+ googleLabel: TextToken(fontName: "Roboto-SemiBold", size: 14, color: .black),
+ pillFill: .white,
+ pillCornerRadius: 80,
+ pillStroke: .black,
+ phoneProvider: Provider(
+ fill: Color(demoHex: 0x00DCE2),
+ label: TextToken(fontName: "ChivoMono-Medium", size: 14, color: Color(demoHex: 0x2C1067)),
+ cornerRadius: 12
+ ),
+ footerText: TextToken(fontName: "ChivoMono-Medium", size: 14, color: Color(demoHex: 0x202124)),
+ footerAccent: TextToken(
+ fontName: "ChivoMono-Bold",
+ size: 14,
+ color: Color(demoHex: 0xFF52B3),
+ underline: true
+ )
+ )
+
+ /// Coffee Spark: the Coffee Spark headline.
+ static let spark = DemoTheme(
+ id: .spark,
+ libraryFontFamily: "JetBrains Mono",
+ pageBackground: Color(demoHex: 0xF1F1F1),
+ // The frame's "title" text is hidden; this size is the Doggo and Grid title's, used on the
+ // screens the design doesn't cover.
+ title: TextToken(fontName: "JetBrainsMono-Medium", size: 28, color: Color(demoHex: 0x1C1B1B)),
+ showsTitle: false,
+ titleSpacing: 12,
+ cardFill: nil,
+ cardCornerRadius: 24,
+ cardPadding: 0,
+ cardShadow: nil,
+ cardStroke: nil,
+ fieldFill: .white,
+ fieldStroke: Stroke(color: .black, width: 2),
+ fieldCornerRadius: 16,
+ fieldText: TextToken(fontName: "JetBrainsMono-Medium", size: 16, color: .black),
+ fieldPlaceholder: .black,
+ fieldIcon: .black,
+ fieldIconWeight: .regular,
+ fieldTrailingIcon: .black,
+ link: TextToken(fontName: "JetBrainsMono-Medium", size: 16, color: Color(demoHex: 0x34A853)),
+ buttonFont: TextToken(fontName: "JetBrainsMono-Bold", size: 20, color: .black),
+ buttonCornerRadius: 40,
+ buttonHeight: 64,
+ buttonStroke: Stroke(color: .black, width: 2),
+ buttonShadow: nil,
+ primaryButton: ButtonColors(fill: Color(demoHex: 0xFDADEE), label: .black),
+ secondaryButton: ButtonColors(fill: Color(demoHex: 0xF3FBFB), label: .black),
+ dividerColor: Color(demoHex: 0xFDFCFB),
+ otherLabel: TextToken(fontName: "JetBrainsMono-Medium", size: 16, color: .black),
+ otherPadding: EdgeInsets(top: 24, leading: 54, bottom: 0, trailing: 54),
+ googleLabel: TextToken(fontName: "Roboto-SemiBold", size: 14, color: .black),
+ pillFill: .white,
+ pillCornerRadius: 80,
+ pillStroke: .black,
+ phoneProvider: Provider(
+ fill: Color(demoHex: 0xC6FF00),
+ label: TextToken(fontName: "ChivoMono-Medium", size: 14, color: Color(demoHex: 0x34A853)),
+ cornerRadius: 40
+ ),
+ footerText: TextToken(fontName: "ChivoMono-Medium", size: 14, color: Color(demoHex: 0x202124)),
+ footerAccent: TextToken(
+ fontName: "ChivoMono-Bold",
+ size: 14,
+ color: Color(demoHex: 0x34A853),
+ underline: true
+ )
+ )
+}
+
+extension DemoTheme {
+ /// Not from a design: a quiet, platform-native look written as a spec. The system font, neutral
+ /// greys with one blue accent, 10-point corners, hairline borders instead of offset shadows,
+ /// no background art, and light and dark variants.
+ static let professional: DemoTheme = {
+ let text = Color(demoLight: 0x111418, dark: 0xF2F4F7)
+ let muted = Color(demoLight: 0x5B6470, dark: 0x9AA3AE)
+ let accent = Color(demoLight: 0x1F5EFF, dark: 0x4C7DFF)
+ // Darker than `accent` in dark mode so white labels on it keep 4.5:1 contrast.
+ let accentFill = Color(demoLight: 0x1F5EFF, dark: 0x2F62F0)
+ let hairline = Color(demoLight: 0xE3E6EA, dark: 0x2A2F36)
+ return DemoTheme(
+ id: .professional,
+ libraryFontFamily: nil,
+ pageBackground: Color(demoLight: 0xF5F6F8, dark: 0x0F1115),
+ title: TextToken(size: 28, weight: .semibold, color: text),
+ showsTitle: true,
+ titleSpacing: 16,
+ cardFill: Color(demoLight: 0xFFFFFF, dark: 0x181B20),
+ cardCornerRadius: 16,
+ cardPadding: 20,
+ cardShadow: nil,
+ cardStroke: Stroke(color: hairline, width: 1),
+ fieldFill: Color(demoLight: 0xFFFFFF, dark: 0x0F1115),
+ fieldStroke: Stroke(color: Color(demoLight: 0xC9CFD6, dark: 0x3A414A), width: 1),
+ fieldCornerRadius: 10,
+ fieldText: TextToken(size: 16, color: text),
+ fieldPlaceholder: Color(demoLight: 0x6B7480, dark: 0x7D8693),
+ fieldIcon: muted,
+ fieldIconWeight: .regular,
+ fieldTrailingIcon: muted,
+ link: TextToken(size: 15, weight: .medium, color: accent),
+ buttonFont: TextToken(size: 17, weight: .semibold, color: .white),
+ buttonCornerRadius: 10,
+ buttonHeight: 52,
+ buttonStroke: nil,
+ buttonShadow: nil,
+ primaryButton: ButtonColors(fill: accentFill, label: .white),
+ secondaryButton: ButtonColors(
+ fill: Color(demoLight: 0xEEF2FF, dark: 0x1C2540),
+ label: Color(demoLight: 0x1F5EFF, dark: 0x9DB5FF)
+ ),
+ dividerColor: hairline,
+ otherLabel: TextToken(size: 15, color: muted),
+ otherPadding: EdgeInsets(top: 20, leading: 24, bottom: 0, trailing: 24),
+ googleLabel: TextToken(size: 15, weight: .semibold, color: text),
+ pillFill: Color(demoLight: 0xFFFFFF, dark: 0x181B20),
+ pillCornerRadius: 10,
+ pillStroke: Color(demoLight: 0xC9CFD6, dark: 0x3A414A),
+ phoneProvider: Provider(
+ fill: accentFill,
+ label: TextToken(size: 15, weight: .semibold, color: .white),
+ cornerRadius: 10
+ ),
+ footerText: TextToken(size: 14, color: muted),
+ footerAccent: TextToken(size: 14, weight: .semibold, color: accent)
+ )
+ }()
+}
+
+// MARK: - Library theming
+
+extension DemoTheme {
+ var typography: AuthTypography {
+ AuthTypography(fontName: libraryFontFamily)
+ }
+
+ /// `AuthTextField` draws `tint` as the focused border and `containerColor` as the unfocused
+ /// one, so the stock fields get the same outline as the demo's own.
+ var textFieldStyle: AuthTextFieldStyle {
+ AuthTextFieldStyle(
+ tint: primaryButton.fill,
+ containerColor: fieldStroke.color,
+ secondaryColor: fieldPlaceholder,
+ errorColor: errorColor,
+ cornerRadius: fieldCornerRadius
+ )
+ }
+
+ var ctaButtonStyle: AuthCTAButtonStyle {
+ AuthCTAButtonStyle(
+ backgroundColor: primaryButton.fill,
+ contentColor: primaryButton.label,
+ shape: .roundedRectangle(radius: buttonCornerRadius),
+ font: buttonFont.font()
+ )
+ }
+}
+
+// MARK: - Background art
+
+/// The background layers of each design, placed at their offsets from the design's top-left
+/// corner: "bg" and "pattern" in Doggo, "Frame 5" in Grid and "avatar spark" in Coffee Spark.
+struct DemoThemeBackground: View {
+ let theme: DemoTheme
+
+ var body: some View {
+ // An overlay, so the art larger than the screen doesn't size the background itself.
+ theme.pageBackground
+ .overlay(alignment: .topLeading) { art }
+ .clipped()
+ .ignoresSafeArea()
+ .accessibilityHidden(true)
+ }
+
+ private var art: some View {
+ ZStack(alignment: .topLeading) {
+ switch theme.id {
+ case .doggo:
+ DoggoGradient()
+ .frame(width: 441.481, height: 934.09)
+ .offset(x: -8, y: 0)
+ art("doggo-pattern", x: -160, y: -680, width: 1031, height: 1042)
+ case .grid:
+ art("grid-pattern", x: -269, y: -75, width: 997, height: 997)
+ case .spark:
+ // The export includes the layer's texture and noise effects, so it is larger than the
+ // 583x568 layer; it is centred on the layer's bounds.
+ art("spark-blob", x: -295.8, y: -317.7, width: 751, height: 735.3)
+ case .professional:
+ EmptyView()
+ }
+ }
+ }
+
+ private func art(_ name: String, x: CGFloat, y: CGFloat, width: CGFloat,
+ height: CGFloat) -> some View {
+ Image("FullCustomization/\(name)")
+ .resizable()
+ .frame(width: width, height: height)
+ .offset(x: x, y: y)
+ .accessibilityIdentifier(name)
+ }
+}
+
+/// Doggo's background: a radial gradient whose ellipse is given by three handle points in the
+/// layer's unit square, drawn by mapping a unit circle onto that ellipse.
+private struct DoggoGradient: View {
+ var body: some View {
+ Canvas { context, size in
+ let origin = CGPoint(x: -0.03 * size.width, y: 0)
+ let axisX = CGPoint(x: 0.95 * size.width - origin.x, y: 0.55 * size.height - origin.y)
+ let axisY = CGPoint(x: -0.83 * size.width - origin.x, y: 1.08 * size.height - origin.y)
+ var unit = context
+ unit.transform = CGAffineTransform(
+ a: axisX.x, b: axisX.y, c: axisY.x, d: axisY.y, tx: origin.x, ty: origin.y
+ )
+ unit.fill(
+ Path(CGRect(x: -2, y: -2, width: 4, height: 4)),
+ with: .radialGradient(
+ Gradient(stops: [
+ .init(color: Color(demoHex: 0xFFF8F8), location: 0.04),
+ .init(color: Color(demoHex: 0xFFDDB4), location: 0.34),
+ .init(color: Color(demoHex: 0xFFD8EB), location: 0.74),
+ ]),
+ center: .zero,
+ startRadius: 0,
+ endRadius: 1
+ )
+ )
+ }
+ }
+}
+
+extension Color {
+ /// A colour that follows the system's light or dark appearance.
+ init(demoLight light: UInt32, dark: UInt32) {
+ self.init(UIColor { traits in
+ UIColor(Color(demoHex: traits.userInterfaceStyle == .dark ? dark : light))
+ })
+ }
+
+ init(demoHex hex: UInt32) {
+ self.init(
+ red: Double((hex >> 16) & 0xFF) / 255,
+ green: Double((hex >> 8) & 0xFF) / 255,
+ blue: Double(hex & 0xFF) / 255
+ )
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/BagelFatOne-400.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/BagelFatOne-400.ttf
new file mode 100644
index 00000000000..2caed33cea2
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/BagelFatOne-400.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-500.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-500.ttf
new file mode 100644
index 00000000000..232a06976f8
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-500.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-700.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-700.ttf
new file mode 100644
index 00000000000..93a56f6de48
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/ChivoMono-700.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-500.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-500.ttf
new file mode 100644
index 00000000000..51ccd916b8e
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-500.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-700.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-700.ttf
new file mode 100644
index 00000000000..1305efce9d6
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/JetBrainsMono-700.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-bagelfatone.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-bagelfatone.txt
new file mode 100644
index 00000000000..21c7b2d4d41
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-bagelfatone.txt
@@ -0,0 +1,93 @@
+Copyright 2022 The Bagel Fat Project Authors (https://github.com/JAMO-TYPEFACE/BagelFat)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-chivomono.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-chivomono.txt
new file mode 100644
index 00000000000..4e5e18cc08e
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-chivomono.txt
@@ -0,0 +1,93 @@
+Copyright 2019 The Chivo Project Authors (https://github.com/Omnibus-Type/Chivo)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-jetbrainsmono.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-jetbrainsmono.txt
new file mode 100644
index 00000000000..821a3dac22a
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-jetbrainsmono.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-onest.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-onest.txt
new file mode 100644
index 00000000000..b6f4f914879
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-onest.txt
@@ -0,0 +1,93 @@
+Copyright 2021 The Onest Project Authors (https://github.com/googlefonts/onest)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-roboto.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-roboto.txt
new file mode 100644
index 00000000000..9c48e05a24f
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-roboto.txt
@@ -0,0 +1,93 @@
+Copyright 2011 The Roboto Project Authors (https://github.com/googlefonts/roboto-classic)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-rowdies.txt b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-rowdies.txt
new file mode 100644
index 00000000000..f51da0012cd
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/OFL-rowdies.txt
@@ -0,0 +1,93 @@
+Copyright 2018 The Rowdies Project Authors (https://github.com/magictype/rowdy)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-500.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-500.ttf
new file mode 100644
index 00000000000..bf4d81d5713
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-500.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-700.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-700.ttf
new file mode 100644
index 00000000000..e5811290b87
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Onest-700.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-500.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-500.ttf
new file mode 100644
index 00000000000..310c9e48da2
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-500.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-600.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-600.ttf
new file mode 100644
index 00000000000..2ef85eada43
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Roboto-600.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-400.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-400.ttf
new file mode 100644
index 00000000000..f65911f72a2
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-400.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-700.ttf b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-700.ttf
new file mode 100644
index 00000000000..ba852339da2
Binary files /dev/null and b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/Fonts/Rowdies-700.ttf differ
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/FullCustomizationExample.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/FullCustomizationExample.swift
new file mode 100644
index 00000000000..c6a284cbe8d
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/FullCustomizationExample.swift
@@ -0,0 +1,239 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAppleSwiftUI
+import FirebaseAuth
+import FirebaseAuthSwiftUI
+import FirebaseGoogleSwiftUI
+import FirebaseOAuthSwiftUI
+import FirebasePhoneAuthSwiftUI
+import SwiftUI
+
+/// Every screen of the authentication sheet drawn by the app, while the library keeps the auth
+/// logic, navigation, MFA, account conflicts and reauthentication.
+///
+/// - `.pickerContent { state in ... }` replaces the whole first screen.
+/// - `.pickerDestination` replaces each pushed screen through its content slot; update password
+/// has no slot and stays stock, falling through to `DefaultAuthPickerDestination`.
+/// - `.signedInContent` replaces the signed-in screen.
+/// - `.reauthContent` replaces the password, phone and email-link reauthentication prompts.
+/// - The theming modifiers restyle the stock screens left in the flow (update password, delete
+/// confirmation) and the library components the demo reuses.
+///
+/// Doggo, Grid and Coffee Spark share one layout and differ only in ``DemoTheme`` values.
+/// Professional brings its own layout, the `Pro…` screens, through the same slots, and pushes a
+/// separate sign-up screen on the `.signUp` route.
+struct FullCustomizationExample: View {
+ /// Its own service, so it can turn on email-link sign-in (part of the themes' designs) without
+ /// changing the other examples.
+ /// Created when the example appears: `NavigationLink` builds its destination eagerly.
+ @State private var authService: AuthService?
+
+ var body: some View {
+ if let authService {
+ FullCustomizationFlow()
+ .environment(authService)
+ } else {
+ Color.clear.onAppear {
+ authService = AuthService(configuration: Self.configuration)
+ .withEmailSignIn(requireDisplayName: true)
+ .withEmailLinkSignIn()
+ .withGoogleSignIn()
+ .withPhoneSignIn()
+ .withAppleSignIn()
+ .withOAuthSignIn(OAuthProviderSwift.github())
+ }
+ }
+ }
+
+ private static var configuration: AuthConfiguration {
+ let actionCodeSettings = ActionCodeSettings()
+ actionCodeSettings.handleCodeInApp = true
+ actionCodeSettings.url = URL(string: "https://flutterfire-e2e-tests.firebaseapp.com")
+ actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
+ actionCodeSettings.linkDomain = "flutterfire-e2e-tests.firebaseapp.com"
+ return AuthConfiguration(
+ tosUrl: URL(string: "https://example.com/tos"),
+ privacyPolicyUrl: URL(string: "https://example.com/privacy"),
+ emailLinkSignInActionCodeSettings: actionCodeSettings,
+ mfaEnabled: true
+ )
+ }
+}
+
+private struct FullCustomizationFlow: View {
+ @Environment(AuthService.self) private var authService
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ let theme = themeID.theme
+ AuthPickerView {
+ home
+ }
+ .pickerContent { state in
+ ThemedLanding(pickerState: state)
+ }
+ .pickerDestination { screen in
+ ThemedDestination(screen: screen)
+ }
+ .signedInContent { state in
+ ThemedSignedIn(state: state)
+ }
+ .reauthContent { prompt in
+ ThemedReauth(prompt: prompt)
+ }
+ .authTypography(theme.typography)
+ .authTextFieldStyle(theme.textFieldStyle)
+ .authCTAButtonStyle(theme.ctaButtonStyle)
+ .modifier(DemoColorScheme(fixed: themeID.colorScheme))
+ }
+
+ private var home: some View {
+ VStack(spacing: 24) {
+ Picker("Theme", selection: $themeID) {
+ ForEach(DemoThemeID.allCases) { theme in
+ Text(theme.label).tag(theme)
+ }
+ }
+ .pickerStyle(.segmented)
+ .accessibilityIdentifier("theme-picker")
+
+ if authService.authenticationState == .authenticated {
+ let user = authService.currentUser
+ Text("Signed in as \(user?.email ?? user?.phoneNumber ?? "")")
+ .authFont(.body)
+ DemoButton(title: "Manage account", identifier: "manage-account-button") {
+ authService.isPresented = true
+ }
+ } else {
+ Text("Not signed in")
+ .authFont(.body)
+ DemoButton(title: "Sign in", identifier: "sign-in-sheet-button") {
+ authService.isPresented = true
+ }
+ }
+ }
+ .padding(24)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background { DemoThemeBackground(theme: themeID.theme) }
+ }
+}
+
+/// Pins the colour scheme for themes that have one, and otherwise passes the system's on.
+/// Unlike `preferredColorScheme`, it takes effect in an open sheet when the theme changes.
+private struct DemoColorScheme: ViewModifier {
+ let fixed: ColorScheme?
+
+ @Environment(\.colorScheme) private var system
+
+ func body(content: Content) -> some View {
+ content.environment(\.colorScheme, fixed ?? system)
+ }
+}
+
+/// The first screen for the selected theme.
+private struct ThemedLanding: View {
+ let pickerState: AuthMethodPickerState
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ if themeID == .professional {
+ ProLanding(pickerState: pickerState)
+ } else {
+ DemoLanding(pickerState: pickerState)
+ }
+ }
+}
+
+/// The pushed screens for the selected theme. Update password has no content slot, so it stays
+/// stock in every theme.
+private struct ThemedDestination: View {
+ let screen: AuthView
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ if themeID == .professional {
+ professional
+ } else {
+ sharedLayout
+ }
+ }
+
+ @ViewBuilder
+ private var professional: some View {
+ switch screen {
+ case .signUp:
+ ProSignUp()
+ case .passwordRecovery:
+ ProPasswordRecovery()
+ case .emailLink:
+ ProEmailLink()
+ case .enterPhoneNumber:
+ ProEnterPhoneNumber()
+ case let .enterVerificationCode(verificationID, fullPhoneNumber):
+ ProEnterVerificationCode(verificationID: verificationID, fullPhoneNumber: fullPhoneNumber)
+ case .mfaEnrollment:
+ ProMFAEnrolment()
+ case .mfaManagement:
+ ProMFAManagement()
+ case let .mfaResolution(mfaRequired):
+ ProMFAResolution(mfaRequired: mfaRequired)
+ default:
+ DefaultAuthPickerDestination(screen: screen)
+ }
+ }
+
+ /// The shared-layout themes switch sign-in and sign-up in place on the first screen.
+ /// `.signUp` only arrives when the theme changes on Professional's pushed sign-up screen.
+ @ViewBuilder
+ private var sharedLayout: some View {
+ switch screen {
+ case .signUp:
+ DemoSignUp()
+ case .passwordRecovery:
+ DemoPasswordRecovery()
+ case .emailLink:
+ DemoEmailLink()
+ case .enterPhoneNumber:
+ DemoEnterPhoneNumber()
+ case let .enterVerificationCode(verificationID, fullPhoneNumber):
+ DemoEnterVerificationCode(verificationID: verificationID, fullPhoneNumber: fullPhoneNumber)
+ case .mfaEnrollment:
+ DemoMFAEnrolment()
+ case .mfaManagement:
+ DemoMFAManagement()
+ case let .mfaResolution(mfaRequired):
+ DemoMFAResolution(mfaRequired: mfaRequired)
+ default:
+ DefaultAuthPickerDestination(screen: screen)
+ }
+ }
+}
+
+/// The signed-in screen for the selected theme.
+private struct ThemedSignedIn: View {
+ let state: SignedInContentState
+
+ @AppStorage(DemoThemeID.storageKey) private var themeID: DemoThemeID = .doggo
+
+ var body: some View {
+ if themeID == .professional {
+ ProAccount(state: state)
+ } else {
+ DemoSignedIn(state: state)
+ }
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalAccountScreens.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalAccountScreens.swift
new file mode 100644
index 00000000000..c1276ce1698
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalAccountScreens.swift
@@ -0,0 +1,525 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuth
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+/// The Professional signed-in screen: an account settings page with grouped rows.
+struct ProAccount: View {
+ let state: SignedInContentState
+
+ private var user: User? { state.user }
+
+ private var providerIDs: [String] {
+ user?.providerData.map(\.providerID) ?? []
+ }
+
+ /// Only accounts that sign in with a password can change one.
+ private var hasPassword: Bool { providerIDs.contains("password") }
+
+ private var signInMethod: String {
+ switch providerIDs.first {
+ case "password": "email"
+ case "phone": "phone"
+ case "google.com": "Google"
+ case "apple.com": "Apple"
+ case "github.com": "GitHub"
+ case let other?: other
+ case nil: "a temporary account"
+ }
+ }
+
+ private var isTwoFactorOn: Bool {
+ !(user?.multiFactor.enrolledFactors.isEmpty ?? true)
+ }
+
+ var body: some View {
+ ProPage {
+ ProHeader(title: "Account")
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ profile
+ ProErrorText(message: state.errorMessage)
+ .padding(.top, 16)
+ security
+ ProGroup {
+ ProRow(
+ title: "Sign out",
+ tint: ProPalette.accent,
+ showsChevron: false,
+ identifier: "sign-out-button",
+ action: state.signOut
+ )
+ }
+ .padding(.top, 24)
+ ProGroup {
+ ProRow(
+ title: "Delete account",
+ tint: ProPalette.danger,
+ showsChevron: false,
+ identifier: "delete-account-button",
+ action: state.deleteAccount
+ )
+ }
+ .padding(.top, 24)
+ Text(
+ "Deleting your account removes your data permanently. You may be asked to sign in again first."
+ )
+ .scaledSystemFont(size: 13)
+ .foregroundStyle(ProPalette.muted)
+ .fixedSize(horizontal: false, vertical: true)
+ .padding(.horizontal, 4)
+ .padding(.top, 8)
+ }
+ .disabled(state.isLoading)
+ }
+ }
+
+ private var profile: some View {
+ let identity = user?.email ?? user?.phoneNumber ?? "Signed in"
+ return HStack(spacing: 14) {
+ Text(String(identity.prefix(1)).uppercased())
+ .scaledSystemFont(size: 22, weight: .semibold)
+ .foregroundStyle(ProPalette.accentSoftText)
+ .frame(width: 56, height: 56)
+ .background(ProPalette.accentSoft, in: Circle())
+ .accessibilityHidden(true)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(identity)
+ .scaledSystemFont(size: 17, weight: .semibold)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ Text("Signed in with \(signInMethod)")
+ .scaledSystemFont(size: 14)
+ .foregroundStyle(ProPalette.muted)
+ }
+ }
+ .accessibilityElement(children: .combine)
+ .accessibilityIdentifier("profile")
+ }
+
+ @ViewBuilder
+ private var security: some View {
+ let email = user?.email
+ if hasPassword || state.isMFAEnabled || email != nil {
+ ProSectionLabel(text: "Security")
+ .padding(.top, 32)
+ ProGroup {
+ if hasPassword {
+ ProRow(
+ symbol: "key",
+ title: "Password",
+ value: "Change",
+ identifier: "update-password-button",
+ action: state.updatePassword
+ )
+ }
+ if state.isMFAEnabled {
+ if hasPassword {
+ ProRowSeparator()
+ }
+ ProRow(
+ symbol: "lock.shield",
+ title: "Two-factor authentication",
+ value: isTwoFactorOn ? "On" : "Off",
+ identifier: "mfa-management-button",
+ action: state.goToMFAManagement
+ )
+ }
+ if email != nil {
+ if hasPassword || state.isMFAEnabled {
+ ProRowSeparator()
+ }
+ ProRow(
+ symbol: "envelope",
+ title: "Email",
+ value: state.isEmailVerified ? "Verified" : "Verify",
+ valueTint: state.isEmailVerified ? ProPalette.muted : ProPalette.accent,
+ showsChevron: false,
+ identifier: "verify-email-button",
+ action: state.isEmailVerified ? {} : state.verifyEmail
+ )
+ .disabled(state.isEmailVerified)
+ }
+ }
+ }
+ }
+}
+
+struct ProMFAManagement: View {
+ var body: some View {
+ MFAManagementScreen { state in
+ ProPage {
+ ProHeader(
+ symbol: "lock.shield",
+ title: "Two-factor authentication",
+ subtitle: state.enrolledFactors.isEmpty
+ ? "Add a second step to sign-in, so a password on its own isn't enough."
+ : "These methods can confirm it's you when you sign in."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ if !state.enrolledFactors.isEmpty {
+ ProSectionLabel(text: "Your methods")
+ ProGroup {
+ let factors = Array(state.enrolledFactors.enumerated())
+ ForEach(factors, id: \.element.uid) { index, factor in
+ if index > 0 {
+ ProRowSeparator(inset: 66)
+ }
+ ProFactorRow(factor: factor) {
+ state.unenroll(factor.uid)
+ }
+ }
+ }
+ .disabled(state.isLoading)
+ }
+ ProErrorText(message: state.errorMessage)
+ .padding(.top, 16)
+ ProPrimaryButton(
+ title: state.enrolledFactors.isEmpty ? "Set up two-factor" : "Add another method",
+ isLoading: state.isLoading,
+ identifier: "add-factor-button",
+ action: state.goToEnrollment
+ )
+ .padding(.top, 8)
+ }
+ }
+ }
+ }
+}
+
+/// An enrolled second factor, with a Remove action.
+private struct ProFactorRow: View {
+ let factor: MultiFactorInfo
+ let remove: () -> Void
+
+ private var isPhone: Bool { factor.factorID == PhoneMultiFactorID }
+
+ var body: some View {
+ HStack(spacing: 14) {
+ ProIconTile(symbol: isPhone ? "message" : "iphone")
+ VStack(alignment: .leading, spacing: 2) {
+ Text(factor.displayName ?? (isPhone ? "Text message" : "Authenticator app"))
+ .scaledSystemFont(size: 16, weight: .medium)
+ Text(isPhone
+ ? (factor as? PhoneMultiFactorInfo)?.phoneNumber ?? "Text message"
+ : "Authenticator app")
+ .scaledSystemFont(size: 14)
+ .foregroundStyle(ProPalette.muted)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ Button("Remove", action: remove)
+ .scaledSystemFont(size: 15, weight: .medium)
+ .foregroundStyle(ProPalette.danger)
+ .frame(minHeight: 44)
+ .buttonStyle(.plain)
+ .accessibilityIdentifier("remove-factor-button")
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 8)
+ }
+}
+
+struct ProMFAEnrolment: View {
+ var body: some View {
+ MFAEnrolmentScreen { ProMFAEnrolmentContent(state: $0) }
+ }
+}
+
+/// The enrolment steps, apart from `MFAEnrolmentScreen` so they can be previewed with a stub
+/// state: the Auth emulator can't enrol TOTP.
+struct ProMFAEnrolmentContent: View {
+ let state: MFAEnrolmentContentState
+
+ var body: some View {
+ switch state.step {
+ case .selectFactor:
+ ProPage {
+ ProHeader(
+ symbol: "lock.shield",
+ title: "Set up two-factor authentication",
+ subtitle: "Add a second step to sign-in, so a password on its own isn't enough."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ ProSectionLabel(text: "Choose a method")
+ ProGroup {
+ ForEach(Array(state.allowedFactors.enumerated()), id: \.element) { index, factor in
+ if index > 0 {
+ ProRowSeparator(inset: 66)
+ }
+ ProChoiceRow(
+ symbol: factor == .sms ? "message" : "iphone",
+ title: factor == .sms ? "Text message" : "Authenticator app",
+ detail: factor == .sms
+ ? "We'll text a code to your phone."
+ : "Use a code from an app like Google Authenticator.",
+ isSelected: state.selectedFactorType.wrappedValue == factor,
+ identifier: factor == .sms ? "sms-factor-button" : "totp-factor-button"
+ ) {
+ state.selectedFactorType.wrappedValue = factor
+ }
+ }
+ }
+ ProErrorText(message: state.isMFAEnabled
+ ? state.errorMessage
+ : "Two-factor sign-in isn't enabled for this app.")
+ .padding(.top, 16)
+ ProPrimaryButton(
+ title: "Continue",
+ isLoading: state.isLoading,
+ identifier: "start-enrollment-button",
+ action: state.startEnrollment
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 12)
+ }
+ }
+ case .enterPhoneNumber:
+ ProPage {
+ ProHeader(
+ symbol: "message",
+ title: "Add your phone number",
+ subtitle: "We'll text a code to this number whenever you sign in."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ nameField
+ ProPhoneField(phoneNumber: state.phoneNumber, country: state.selectedCountry)
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ }
+ case .enterVerificationCode:
+ ProPage {
+ ProHeader(
+ symbol: "number",
+ title: "Confirm the code",
+ subtitle: "We sent a 6-digit code to \(state.sentPhoneNumber ?? "your phone")."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ codeField(state.verificationCode)
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "enroll-button",
+ action: state.enroll
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ ProTextButton(
+ title: "Resend code",
+ identifier: "resend-code-button",
+ action: state.sendCode
+ )
+ .disabled(state.isLoading)
+ .padding(.top, 4)
+ }
+ case .setUpTOTP:
+ ProPage {
+ ProHeader(
+ symbol: "qrcode",
+ title: "Scan to set up",
+ subtitle: "Scan the code with your authenticator app, or enter the key by hand."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ if let url = state.totpQRCodeURL {
+ DemoQRCode(url: url)
+ }
+ if let secret = state.totpSecret {
+ HStack(spacing: 12) {
+ Text(secret)
+ .scaledSystemFont(size: 15, design: .monospaced)
+ .lineLimit(1)
+ .minimumScaleFactor(0.7)
+ .textSelection(.enabled)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ Button(state.didCopySecret ? "Copied" : "Copy", action: state.copySecret)
+ .scaledSystemFont(size: 15, weight: .medium)
+ .foregroundStyle(ProPalette.accent)
+ .buttonStyle(.plain)
+ .accessibilityIdentifier("copy-secret-button")
+ }
+ .padding(.horizontal, 14)
+ .frame(minHeight: 48)
+ .proFieldBox()
+ .accessibilityIdentifier("totp-secret")
+ }
+ nameField
+ codeField(state.totpCode)
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "enroll-button",
+ action: state.enroll
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ }
+ // Later releases may add steps.
+ @unknown default:
+ DefaultMFAEnrolmentContent(state: state)
+ }
+ }
+
+ private var nameField: some View {
+ ProField(
+ label: "Name",
+ placeholder: "For example, Work phone",
+ text: state.displayName,
+ identifier: "display-name-field"
+ )
+ }
+
+ private func codeField(_ code: Binding) -> some View {
+ ProField(
+ label: "Verification code",
+ placeholder: "6-digit code",
+ text: code,
+ keyboard: .numberPad,
+ contentType: .oneTimeCode,
+ identifier: "verification-code-field"
+ )
+ }
+}
+
+struct ProMFAResolution: View {
+ let mfaRequired: MFARequired
+
+ var body: some View {
+ MFAResolutionScreen(mfaRequired: mfaRequired) { state in
+ let hint = selectedHint(state)
+ ProPage {
+ ProHeader(symbol: "lock.shield", title: "Verify it's you", subtitle: subtitle(hint, state))
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ if state.hints.count > 1 {
+ ProSectionLabel(text: "Choose a method")
+ ProGroup {
+ ForEach(Array(state.hints.enumerated()), id: \.offset) { index, option in
+ if index > 0 {
+ ProRowSeparator(inset: 66)
+ }
+ ProChoiceRow(
+ symbol: isPhone(option) ? "message" : "iphone",
+ title: title(for: option),
+ detail: detail(for: option),
+ isSelected: state.selectedHintIndex.wrappedValue == index,
+ identifier: "hint-\(index)-button"
+ ) {
+ state.selectedHintIndex.wrappedValue = index
+ }
+ }
+ }
+ .padding(.bottom, 24)
+ }
+ VStack(alignment: .leading, spacing: 16) {
+ if let hint, !isPhone(hint) || state.isCodeSent {
+ ProField(
+ label: "Verification code",
+ placeholder: "6-digit code",
+ text: isPhone(hint) ? state.verificationCode : state.totpCode,
+ keyboard: .numberPad,
+ contentType: .oneTimeCode,
+ identifier: "verification-code-field"
+ )
+ }
+ ProErrorText(message: state.errorMessage)
+ if let hint, isPhone(hint), !state.isCodeSent {
+ ProPrimaryButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ } else {
+ ProPrimaryButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "resolve-button",
+ action: state.resolve
+ )
+ .disabled(!state.isValid)
+ }
+ }
+ if let hint, isPhone(hint), state.isCodeSent {
+ ProTextButton(
+ title: "Resend code",
+ identifier: "resend-code-button",
+ action: state.sendCode
+ )
+ .disabled(state.isLoading)
+ .padding(.top, 4)
+ }
+ ProTextButton(title: "Cancel", identifier: "cancel-button", action: state.cancel)
+ .padding(.top, 4)
+ }
+ }
+ }
+ }
+
+ private func selectedHint(_ state: MFAResolutionContentState) -> MFAHint? {
+ let index = state.selectedHintIndex.wrappedValue
+ return state.hints.indices.contains(index) ? state.hints[index] : nil
+ }
+
+ private func isPhone(_ hint: MFAHint) -> Bool {
+ if case .phone = hint {
+ return true
+ }
+ return false
+ }
+
+ private func title(for hint: MFAHint) -> String {
+ switch hint {
+ case let .phone(displayName, _, _): displayName ?? "Text message"
+ case let .totp(displayName, _): displayName ?? "Authenticator app"
+ }
+ }
+
+ private func detail(for hint: MFAHint) -> String {
+ switch hint {
+ case let .phone(_, _, phoneNumber): phoneNumber ?? "Text message"
+ case .totp: "Authenticator app"
+ }
+ }
+
+ private func subtitle(_ hint: MFAHint?, _ state: MFAResolutionContentState) -> String {
+ switch hint {
+ case let .phone(_, _, phoneNumber):
+ state.isCodeSent
+ ? "Enter the 6-digit code we sent to \(phoneNumber ?? "your phone")."
+ : "Your account uses two-factor authentication. We'll text a code to \(phoneNumber ?? "your phone")."
+ case .totp:
+ "Enter the 6-digit code from your authenticator app."
+ case nil:
+ "Your account uses two-factor authentication."
+ }
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalComponents.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalComponents.swift
new file mode 100644
index 00000000000..d950a89a959
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalComponents.swift
@@ -0,0 +1,555 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+// The Professional theme's own layout: flat, left-aligned pages with labelled fields and grouped
+// rows, instead of the layout the other themes share. Its values match
+// ``DemoTheme/professional``.
+
+/// Professional colours, each with a light and a dark variant.
+enum ProPalette {
+ static let background = Color(demoLight: 0xF5F6F8, dark: 0x0F1115)
+ static let surface = Color(demoLight: 0xFFFFFF, dark: 0x181B20)
+ static let field = Color(demoLight: 0xFFFFFF, dark: 0x0F1115)
+ static let text = Color(demoLight: 0x111418, dark: 0xF2F4F7)
+ static let muted = Color(demoLight: 0x5B6470, dark: 0x9AA3AE)
+ static let placeholder = Color(demoLight: 0x6B7480, dark: 0x7D8693)
+ static let border = Color(demoLight: 0xC9CFD6, dark: 0x3A414A)
+ static let hairline = Color(demoLight: 0xE3E6EA, dark: 0x2A2F36)
+ /// Links and text-only actions.
+ static let accent = Color(demoLight: 0x1F5EFF, dark: 0x4C7DFF)
+ /// Filled buttons: darker than ``accent`` in dark mode so white labels keep 4.5:1 contrast.
+ static let accentFill = Color(demoLight: 0x1F5EFF, dark: 0x2F62F0)
+ static let accentSoft = Color(demoLight: 0xEEF2FF, dark: 0x1C2540)
+ static let accentSoftText = Color(demoLight: 0x1F5EFF, dark: 0x9DB5FF)
+ static let tile = Color(demoLight: 0xEEF0F3, dark: 0x22262D)
+ static let danger = Color(demoLight: 0xB42318, dark: 0xF97066)
+ static let chevron = Color(demoLight: 0x9AA3AE, dark: 0x5B6470)
+}
+
+/// The scaffold every Professional screen shares: a scrolling, left-aligned column with a header,
+/// the screen's content and an optional footer. The footer sits at the bottom when the content is
+/// short, and scrolls with it otherwise, so the keyboard never pushes it over a button.
+struct ProPage: View {
+ /// `showsThemeMenu` is off for screens in their own sheet, such as reauthentication.
+ init(showsThemeMenu: Bool = true,
+ @ViewBuilder header: () -> Header,
+ @ViewBuilder content: () -> Content,
+ @ViewBuilder footer: () -> Footer = { EmptyView() }) {
+ self.showsThemeMenu = showsThemeMenu
+ self.header = header()
+ self.content = content()
+ self.footer = footer()
+ }
+
+ private let showsThemeMenu: Bool
+ private let header: Header
+ private let content: Content
+ private let footer: Footer
+
+ var body: some View {
+ GeometryReader { proxy in
+ ScrollView {
+ VStack(alignment: .leading, spacing: 0) {
+ header
+ content
+ .padding(.top, 28)
+ Spacer(minLength: 32)
+ footer
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .demoContentWidth()
+ .padding(.top, 8)
+ .padding(.bottom, 16)
+ .frame(minHeight: proxy.size.height, alignment: .top)
+ }
+ .scrollBounceBehavior(.basedOnSize)
+ }
+ .foregroundStyle(ProPalette.text)
+ .background(ProPalette.background.ignoresSafeArea())
+ .navigationTitle("")
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar {
+ if showsThemeMenu {
+ ToolbarItem(placement: .topBarLeading) {
+ DemoThemeMenu()
+ }
+ }
+ }
+ }
+}
+
+/// A title and a one-line explanation, under an optional icon tile.
+struct ProHeader: View {
+ var symbol: String?
+ let title: String
+ var subtitle: String?
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ if let symbol {
+ ProIconTile(symbol: symbol, size: 44)
+ .padding(.bottom, 20)
+ }
+ Text(title)
+ .scaledSystemFont(size: 26, weight: .semibold)
+ .tracking(-0.3)
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityAddTraits(.isHeader)
+ .accessibilityIdentifier("title")
+ if let subtitle {
+ Text(subtitle)
+ .scaledSystemFont(size: 15)
+ .foregroundStyle(ProPalette.muted)
+ .fixedSize(horizontal: false, vertical: true)
+ .padding(.top, 6)
+ }
+ }
+ }
+}
+
+/// An SF Symbol on a soft accent square.
+struct ProIconTile: View {
+ let symbol: String
+ var size: CGFloat = 36
+ var fill: Color = ProPalette.accentSoft
+ var tint: Color = ProPalette.accentSoftText
+
+ var body: some View {
+ Image(systemName: symbol)
+ .font(.system(size: size * 0.45, weight: .medium))
+ .foregroundStyle(tint)
+ .frame(width: size, height: size)
+ .background(fill, in: RoundedRectangle(cornerRadius: size * 0.28))
+ .accessibilityHidden(true)
+ }
+}
+
+/// A text field with its label above it. `accessory` sits on the label's row, such as a
+/// "Forgot password?" link.
+struct ProField: View {
+ let label: String
+ let placeholder: String
+ @Binding var text: String
+ var isSecure = false
+ var keyboard: UIKeyboardType = .default
+ var contentType: UITextContentType?
+ var identifier: String
+ @ViewBuilder var accessory: () -> Accessory
+
+ @State private var isRevealed = false
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(alignment: .firstTextBaseline) {
+ Text(label)
+ .scaledSystemFont(size: 14, weight: .medium)
+ Spacer(minLength: 8)
+ accessory()
+ }
+ HStack(spacing: 0) {
+ Group {
+ if isSecure, !isRevealed {
+ SecureField(text: $text) { placeholderText }
+ } else {
+ TextField(text: $text) { placeholderText }
+ }
+ }
+ .scaledSystemFont(size: 16)
+ .keyboardType(keyboard)
+ .textContentType(contentType)
+ .textInputAutocapitalization(.never)
+ .autocorrectionDisabled()
+ .accessibilityLabel(label)
+ .accessibilityIdentifier(identifier)
+ if isSecure {
+ Button {
+ isRevealed.toggle()
+ } label: {
+ Image(systemName: isRevealed ? "eye.slash" : "eye")
+ .foregroundStyle(ProPalette.muted)
+ .frame(width: 44, height: 44)
+ }
+ .accessibilityLabel(isRevealed ? "Hide password" : "Show password")
+ }
+ }
+ .padding(.leading, 14)
+ .padding(.trailing, isSecure ? 2 : 14)
+ .frame(minHeight: 48)
+ .proFieldBox()
+ }
+ }
+
+ private var placeholderText: Text {
+ Text(placeholder).foregroundStyle(ProPalette.placeholder)
+ }
+}
+
+extension ProField where Accessory == EmptyView {
+ init(label: String,
+ placeholder: String,
+ text: Binding,
+ isSecure: Bool = false,
+ keyboard: UIKeyboardType = .default,
+ contentType: UITextContentType? = nil,
+ identifier: String) {
+ self.init(
+ label: label,
+ placeholder: placeholder,
+ text: text,
+ isSecure: isSecure,
+ keyboard: keyboard,
+ contentType: contentType,
+ identifier: identifier,
+ accessory: { EmptyView() }
+ )
+ }
+}
+
+extension View {
+ /// The Professional text field's box: field fill, 1-point border, 10-point corners.
+ func proFieldBox() -> some View {
+ let shape = RoundedRectangle(cornerRadius: 10)
+ return background(ProPalette.field, in: shape)
+ .overlay { shape.strokeBorder(ProPalette.border, lineWidth: 1) }
+ }
+}
+
+/// The phone number field: the library's `CountrySelector` beside a number field.
+struct ProPhoneField: View {
+ let phoneNumber: Binding
+ let country: Binding
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Text("Phone number")
+ .scaledSystemFont(size: 14, weight: .medium)
+ HStack(spacing: 10) {
+ CountrySelector(selectedCountry: country)
+ .tint(ProPalette.text)
+ .accessibilityIdentifier("country-selector")
+ Rectangle()
+ .fill(ProPalette.hairline)
+ .frame(width: 1, height: 24)
+ TextField(text: phoneNumber) {
+ Text("555 123 4567").foregroundStyle(ProPalette.placeholder)
+ }
+ .scaledSystemFont(size: 16)
+ .keyboardType(.phonePad)
+ .textContentType(.telephoneNumber)
+ .accessibilityLabel("Phone number")
+ .accessibilityIdentifier("phone-number-field")
+ }
+ .padding(.horizontal, 14)
+ .frame(minHeight: 48)
+ .proFieldBox()
+ }
+ }
+}
+
+/// The full-width filled button.
+struct ProPrimaryButton: View {
+ let title: String
+ var isLoading = false
+ var identifier: String
+ let action: () -> Void
+
+ @Environment(\.isEnabled) private var isEnabled
+
+ var body: some View {
+ Button(action: action) {
+ ZStack {
+ Text(title)
+ .scaledSystemFont(size: 17, weight: .semibold)
+ .opacity(isLoading ? 0 : 1)
+ if isLoading {
+ ProgressView().tint(.white)
+ }
+ }
+ .foregroundStyle(.white)
+ .frame(maxWidth: .infinity, minHeight: 52)
+ .background(ProPalette.accentFill, in: RoundedRectangle(cornerRadius: 10))
+ .opacity(isEnabled ? 1 : 0.45)
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// A full-width outlined button, for the sign-in providers.
+struct ProOutlineButton: View {
+ let title: String
+ var identifier: String
+ @ViewBuilder let icon: () -> Icon
+ let action: () -> Void
+
+ var body: some View {
+ let shape = RoundedRectangle(cornerRadius: 10)
+ Button(action: action) {
+ HStack(spacing: 10) {
+ icon()
+ .frame(width: 20, height: 20)
+ Text(title)
+ .scaledSystemFont(size: 15, weight: .semibold)
+ }
+ .foregroundStyle(ProPalette.text)
+ .frame(maxWidth: .infinity, minHeight: 48)
+ .background(ProPalette.surface, in: shape)
+ .overlay { shape.strokeBorder(ProPalette.border, lineWidth: 1) }
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// A text-only action in the accent colour, 44 points tall.
+struct ProTextButton: View {
+ let title: String
+ var alignment: Alignment = .center
+ var identifier: String
+ let action: () -> Void
+
+ @Environment(\.isEnabled) private var isEnabled
+
+ var body: some View {
+ Button(action: action) {
+ Text(title)
+ .scaledSystemFont(size: 15, weight: .medium)
+ .foregroundStyle(ProPalette.accent)
+ .opacity(isEnabled ? 1 : 0.5)
+ .frame(maxWidth: .infinity, minHeight: 44, alignment: alignment)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// "Prompt? Action", centred, with only the action tappable.
+struct ProPromptLink: View {
+ let prompt: String
+ let action: String
+ var identifier: String
+ let perform: () -> Void
+
+ var body: some View {
+ HStack(spacing: 4) {
+ Text(prompt)
+ .foregroundStyle(ProPalette.muted)
+ Button(action: perform) {
+ Text(action)
+ .fontWeight(.medium)
+ .foregroundStyle(ProPalette.accent)
+ .frame(minHeight: 44)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+ .scaledSystemFont(size: 15)
+ .frame(maxWidth: .infinity)
+ }
+}
+
+/// A rule with a short label in the middle.
+struct ProDivider: View {
+ let label: String
+
+ var body: some View {
+ HStack(spacing: 12) {
+ line
+ Text(label)
+ .scaledSystemFont(size: 13)
+ .foregroundStyle(ProPalette.muted)
+ .fixedSize()
+ line
+ }
+ }
+
+ private var line: some View {
+ Rectangle().fill(ProPalette.hairline).frame(height: 1)
+ }
+}
+
+/// A content slot's `errorMessage`.
+struct ProErrorText: View {
+ let message: String?
+
+ var body: some View {
+ if let message {
+ Label {
+ Text(message)
+ .fixedSize(horizontal: false, vertical: true)
+ } icon: {
+ Image(systemName: "exclamationmark.circle")
+ }
+ .scaledSystemFont(size: 14)
+ .foregroundStyle(ProPalette.danger)
+ .accessibilityIdentifier("error-message")
+ }
+ }
+}
+
+/// A small uppercase label above a ``ProGroup``.
+struct ProSectionLabel: View {
+ let text: String
+
+ var body: some View {
+ Text(text)
+ .scaledSystemFont(size: 13, weight: .medium)
+ .tracking(0.3)
+ .textCase(.uppercase)
+ .foregroundStyle(ProPalette.muted)
+ .padding(.horizontal, 4)
+ .padding(.bottom, 8)
+ }
+}
+
+/// Grouped rows on a bordered card, like an iOS Settings section. Separate rows with
+/// ``ProRowSeparator``.
+struct ProGroup: View {
+ @ViewBuilder let content: () -> Content
+
+ var body: some View {
+ let shape = RoundedRectangle(cornerRadius: 12)
+ VStack(spacing: 0, content: content)
+ .background(ProPalette.surface, in: shape)
+ .clipShape(shape)
+ .overlay { shape.strokeBorder(ProPalette.hairline, lineWidth: 1) }
+ }
+}
+
+/// The hairline between rows, inset past a row's icon.
+struct ProRowSeparator: View {
+ var inset: CGFloat = 48
+
+ var body: some View {
+ Rectangle()
+ .fill(ProPalette.hairline)
+ .frame(height: 1)
+ .padding(.leading, inset)
+ }
+}
+
+/// One tappable settings row: an optional icon, a title, an optional value and a chevron.
+struct ProRow: View {
+ var symbol: String?
+ let title: String
+ var value: String?
+ var valueTint: Color = ProPalette.muted
+ var tint: Color = ProPalette.text
+ var showsChevron = true
+ var identifier: String
+ let action: () -> Void
+
+ var body: some View {
+ Button(action: action) {
+ HStack(spacing: 12) {
+ if let symbol {
+ Image(systemName: symbol)
+ .scaledSystemFont(size: 17)
+ .frame(width: 20)
+ .accessibilityHidden(true)
+ }
+ Text(title)
+ .scaledSystemFont(size: 16, weight: symbol == nil ? .medium : .regular)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ if let value {
+ Text(value)
+ .scaledSystemFont(size: 15)
+ .foregroundStyle(valueTint)
+ }
+ if showsChevron {
+ Image(systemName: "chevron.right")
+ .scaledSystemFont(size: 13, weight: .semibold)
+ .foregroundStyle(ProPalette.chevron)
+ .accessibilityHidden(true)
+ }
+ }
+ .foregroundStyle(tint)
+ .padding(.horizontal, 16)
+ .frame(minHeight: 52)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// A selectable row in a ``ProGroup``: icon tile, title, description and a radio mark.
+struct ProChoiceRow: View {
+ let symbol: String
+ let title: String
+ let detail: String
+ let isSelected: Bool
+ var identifier: String
+ let action: () -> Void
+
+ var body: some View {
+ Button(action: action) {
+ HStack(spacing: 14) {
+ ProIconTile(
+ symbol: symbol,
+ fill: isSelected ? ProPalette.accentSoft : ProPalette.tile,
+ tint: isSelected ? ProPalette.accentSoftText : ProPalette.text
+ )
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title)
+ .scaledSystemFont(size: 16, weight: .medium)
+ Text(detail)
+ .scaledSystemFont(size: 14)
+ .foregroundStyle(ProPalette.muted)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ Image(systemName: isSelected ? "largecircle.fill.circle" : "circle")
+ .scaledSystemFont(size: 22)
+ .foregroundStyle(isSelected ? ProPalette.accent : ProPalette.border)
+ .accessibilityHidden(true)
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 14)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityAddTraits(isSelected ? .isSelected : [])
+ .accessibilityIdentifier(identifier)
+ }
+}
+
+/// The terms line for screens that create or sign in to an account, from the configured URLs.
+struct ProLegalText: View {
+ var prefix = "By continuing, you agree to the"
+
+ @Environment(AuthService.self) private var authService
+
+ var body: some View {
+ let configuration = authService.configuration
+ if let tos = configuration.tosUrl, let privacy = configuration.privacyPolicyUrl,
+ let terms = try? AttributedString(markdown: """
+ \(prefix) [Terms of Service](\(tos.absoluteString)) \
+ and [Privacy Policy](\(privacy.absoluteString)).
+ """) {
+ Text(terms)
+ .scaledSystemFont(size: 13)
+ .foregroundStyle(ProPalette.muted)
+ .tint(ProPalette.accent)
+ .multilineTextAlignment(.center)
+ .frame(maxWidth: .infinity)
+ .accessibilityIdentifier("terms")
+ }
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalSignInScreens.swift b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalSignInScreens.swift
new file mode 100644
index 00000000000..c7753b83b28
--- /dev/null
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/FullCustomization/ProfessionalSignInScreens.swift
@@ -0,0 +1,457 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import FirebaseAuthSwiftUI
+import SwiftUI
+
+/// The Professional first screen: the sign-in providers first, then the email form. Creating an
+/// account is its own pushed screen (``ProSignUp``), reached through `goToSignUp`.
+struct ProLanding: View {
+ let pickerState: AuthMethodPickerState
+
+ @State private var isShowingOtherProviders = false
+ @State private var pendingProvider: AuthProviderUI?
+
+ private var google: AuthProviderUI? {
+ pickerState.providers.first { $0.id == "google.com" }
+ }
+
+ private var phone: AuthProviderUI? {
+ pickerState.providers.first { $0.id == "phone" }
+ }
+
+ private var otherProviders: [AuthProviderUI] {
+ pickerState.providers.filter { $0.id != "google.com" && $0.id != "phone" }
+ }
+
+ var body: some View {
+ EmailAuthScreen(flow: .signIn) { state in
+ ProPage {
+ VStack(alignment: .leading, spacing: 28) {
+ HStack(spacing: 10) {
+ ProIconTile(symbol: "shield", size: 32, fill: ProPalette.accentFill, tint: .white)
+ Text("FirebaseUI Demo")
+ .scaledSystemFont(size: 15, weight: .semibold)
+ }
+ ProHeader(
+ title: "Sign in to your account",
+ subtitle: "Welcome back. Choose how you'd like to continue."
+ )
+ }
+ } content: {
+ VStack(alignment: .leading, spacing: 0) {
+ providers
+ if pickerState.isEmailSignInEnabled {
+ if !pickerState.providers.isEmpty {
+ ProDivider(label: "or continue with email")
+ .padding(.vertical, 22)
+ }
+ emailForm(state)
+ }
+ }
+ } footer: {
+ ProLegalText()
+ }
+ }
+ // Sign-in starts once the sheet is gone, so a provider that presents its own screen
+ // (such as an OAuth web view) isn't presented from a sheet that is animating away.
+ .sheet(isPresented: $isShowingOtherProviders, onDismiss: {
+ if let provider = pendingProvider {
+ pendingProvider = nil
+ pickerState.select(provider)
+ }
+ }) {
+ DemoOtherProvidersSheet(providers: otherProviders) { provider in
+ pendingProvider = provider
+ isShowingOtherProviders = false
+ }
+ .presentationDetents([.medium, .large])
+ }
+ }
+
+ private var providers: some View {
+ VStack(spacing: 10) {
+ if let google {
+ ProOutlineButton(title: "Continue with Google", identifier: "google-button") {
+ Image("FullCustomization/google-g")
+ } action: {
+ pickerState.select(google)
+ }
+ }
+ if let phone {
+ ProOutlineButton(title: "Continue with phone", identifier: "phone-button") {
+ Image(systemName: "phone")
+ } action: {
+ pickerState.select(phone)
+ }
+ }
+ if !otherProviders.isEmpty {
+ ProOutlineButton(title: "More sign-in options", identifier: "other-providers-button") {
+ Image(systemName: "ellipsis.circle")
+ } action: {
+ isShowingOtherProviders = true
+ }
+ }
+ }
+ }
+
+ @ViewBuilder
+ private func emailForm(_ state: EmailAuthContentState) -> some View {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Email",
+ placeholder: "name@company.com",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ ProField(
+ label: "Password",
+ placeholder: "Enter your password",
+ text: state.password,
+ isSecure: true,
+ contentType: .password,
+ identifier: "password-field"
+ ) {
+ Button("Forgot password?", action: state.goToPasswordRecovery)
+ .scaledSystemFont(size: 14, weight: .medium)
+ .foregroundStyle(ProPalette.accent)
+ .buttonStyle(.plain)
+ .accessibilityIdentifier("forgot-password")
+ }
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Sign in",
+ isLoading: state.isLoading,
+ identifier: "sign-in-button",
+ action: state.signIn
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ if pickerState.isEmailLinkEnabled {
+ ProTextButton(
+ title: "Email me a sign-in link",
+ identifier: "email-link-button",
+ action: state.selectEmailLink
+ )
+ .padding(.top, 4)
+ }
+ if state.canSignUp {
+ ProPromptLink(
+ prompt: "Don't have an account?",
+ action: "Create account",
+ identifier: "create-account-button",
+ perform: state.goToSignUp
+ )
+ .padding(.top, 4)
+ }
+ }
+}
+
+/// The pushed sign-up screen, on the `.signUp` route.
+struct ProSignUp: View {
+ @Environment(\.dismiss) private var dismiss
+
+ var body: some View {
+ EmailAuthScreen(flow: .signUp) { state in
+ ProPage {
+ ProHeader(
+ symbol: "person.badge.plus",
+ title: "Create your account",
+ subtitle: "Sign up with your email. It takes less than a minute."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ if state.requiresDisplayName {
+ ProField(
+ label: "Name",
+ placeholder: "Your full name",
+ text: state.displayName,
+ contentType: .name,
+ identifier: "name-field"
+ )
+ }
+ ProField(
+ label: "Email",
+ placeholder: "name@company.com",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ ProField(
+ label: "Password",
+ placeholder: "At least 6 characters",
+ text: state.password,
+ isSecure: true,
+ contentType: .newPassword,
+ identifier: "password-field"
+ )
+ ProField(
+ label: "Confirm password",
+ placeholder: "Repeat your password",
+ text: state.confirmPassword,
+ isSecure: true,
+ contentType: .newPassword,
+ identifier: "confirm-password-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Create account",
+ isLoading: state.isLoading,
+ identifier: "create-account-submit",
+ action: state.signUp
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ // The sign-in form is on the landing underneath, so go back to it. `switchFlow` would
+ // push the `.signIn` route, a second sign-in screen this layout doesn't draw.
+ ProPromptLink(
+ prompt: "Already have an account?",
+ action: "Sign in",
+ identifier: "sign-in-instead-button",
+ perform: { dismiss() }
+ )
+ .padding(.top, 8)
+ } footer: {
+ ProLegalText(prefix: "By creating an account, you agree to the")
+ }
+ }
+ }
+}
+
+struct ProPasswordRecovery: View {
+ var body: some View {
+ PasswordRecoveryScreen { state in
+ if state.didSend {
+ ProPage {
+ ProHeader(
+ symbol: "envelope.badge",
+ title: "Check your inbox",
+ subtitle: "We sent a link to reset your password to \(state.sentEmail)."
+ )
+ } content: {
+ ProPrimaryButton(
+ title: "Back to sign in",
+ identifier: "back-to-sign-in-button",
+ action: state.dismissSuccess
+ )
+ }
+ } else {
+ ProPage {
+ ProHeader(
+ symbol: "lock",
+ title: "Reset your password",
+ subtitle: "Enter the email you sign in with and we'll send you a link to choose a new password."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Email",
+ placeholder: "name@company.com",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Send reset link",
+ isLoading: state.isLoading,
+ identifier: "send-reset-link-button",
+ action: state.sendResetLink
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ }
+ }
+ }
+ }
+}
+
+struct ProEmailLink: View {
+ var body: some View {
+ EmailLinkScreen { state in
+ if state.needsEmailConfirmation {
+ // The link was opened on a device that didn't request it.
+ ProPage {
+ ProHeader(
+ symbol: "envelope.open",
+ title: "Confirm your email",
+ subtitle: "Enter the email address the sign-in link was sent to."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Email",
+ placeholder: "name@company.com",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Sign in",
+ isLoading: state.isLoading,
+ identifier: "confirm-email-button",
+ action: state.confirmEmail
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ ProTextButton(
+ title: "Send a new link instead",
+ identifier: "cancel-confirmation-button",
+ action: state.cancelConfirmation
+ )
+ .disabled(state.isLoading)
+ }
+ } else if state.didSend {
+ ProPage {
+ ProHeader(
+ symbol: "envelope.badge",
+ title: "Check your inbox",
+ subtitle: "We sent a sign-in link to \(state.email.wrappedValue). Open it to finish signing in."
+ )
+ } content: {
+ ProErrorText(message: state.errorMessage)
+ ProTextButton(
+ title: "Use a different email",
+ identifier: "different-email-button",
+ action: state.dismissAlert
+ )
+ .disabled(state.isLoading)
+ }
+ } else {
+ ProPage {
+ ProHeader(
+ symbol: "envelope",
+ title: "Sign in with a link",
+ subtitle: "We'll email you a link that signs you in, no password needed."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Email",
+ placeholder: "name@company.com",
+ text: state.email,
+ keyboard: .emailAddress,
+ contentType: .emailAddress,
+ identifier: "email-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Send link",
+ isLoading: state.isLoading,
+ identifier: "send-login-link-button",
+ action: state.sendSignInLink
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ }
+ }
+ }
+ }
+}
+
+struct ProEnterPhoneNumber: View {
+ var body: some View {
+ EnterPhoneNumberScreen { state in
+ ProPage {
+ ProHeader(
+ symbol: "phone",
+ title: "Sign in with your phone",
+ subtitle: "We'll text you a 6-digit code to confirm it's you. Message and data rates may apply."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProPhoneField(phoneNumber: state.phoneNumber, country: state.selectedCountry)
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Send code",
+ isLoading: state.isLoading,
+ identifier: "send-code-button",
+ action: state.sendCode
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ }
+ }
+ }
+}
+
+struct ProEnterVerificationCode: View {
+ let verificationID: String
+ let fullPhoneNumber: String
+
+ var body: some View {
+ EnterVerificationCodeScreen(
+ verificationID: verificationID,
+ fullPhoneNumber: fullPhoneNumber
+ ) { state in
+ ProPage {
+ ProHeader(
+ symbol: "number",
+ title: "Enter the code",
+ subtitle: "We sent a 6-digit code to \(state.fullPhoneNumber)."
+ )
+ } content: {
+ VStack(alignment: .leading, spacing: 16) {
+ ProField(
+ label: "Verification code",
+ placeholder: "6-digit code",
+ text: state.verificationCode,
+ keyboard: .numberPad,
+ contentType: .oneTimeCode,
+ identifier: "verification-code-field"
+ )
+ ProErrorText(message: state.errorMessage)
+ ProPrimaryButton(
+ title: "Verify",
+ isLoading: state.isLoading,
+ identifier: "verify-button",
+ action: state.verify
+ )
+ .disabled(!state.isValid)
+ .padding(.top, 4)
+ }
+ HStack {
+ ProTextButton(
+ title: state.resendCountdown > 0
+ ? "Resend code in \(state.resendCountdown)s"
+ : "Resend code",
+ alignment: .leading,
+ identifier: "resend-code-button",
+ action: state.resendCode
+ )
+ .disabled(state.resendCountdown > 0 || state.isLoading)
+ ProTextButton(
+ title: "Use a different number",
+ alignment: .trailing,
+ identifier: "change-number-button",
+ action: state.changeNumber
+ )
+ }
+ .padding(.top, 4)
+ }
+ }
+ }
+}
diff --git a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Info.plist b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Info.plist
index 972c78a5b8c..53436b39dfa 100644
--- a/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Info.plist
+++ b/samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Info.plist
@@ -43,6 +43,20 @@
fbapifb-messenger-share-api
+ UIAppFonts
+
+ BagelFatOne-400.ttf
+ ChivoMono-500.ttf
+ ChivoMono-700.ttf
+ JetBrainsMono-500.ttf
+ JetBrainsMono-700.ttf
+ Onest-500.ttf
+ Onest-700.ttf
+ Roboto-500.ttf
+ Roboto-600.ttf
+ Rowdies-400.ttf
+ Rowdies-700.ttf
+ UIBackgroundModesfetch