Skip to content

wip: Auth picker view picker content#1369

Draft
demolaf wants to merge 7 commits into
mainfrom
auth-picker-view-picker-content
Draft

wip: Auth picker view picker content#1369
demolaf wants to merge 7 commits into
mainfrom
auth-picker-view-picker-content

Conversation

@demolaf

@demolaf demolaf commented Jul 8, 2026

Copy link
Copy Markdown
Member
  private let tint = Color.orange
  private let background = Color(red: 42 / 255, green: 1 / 255, blue: 52 / 255)
  private let container = Color(.secondarySystemBackground)
  private let secondary = Color.gray
  private let error = Color.red

  var body: some View {
    AuthPickerView {
      authenticatedApp
    }
    .pickerContent {
      AuthPickerContentView { providers, onProviderSelected in
        SpotlightMethodPicker(providers: providers, onProviderSelected: onProviderSelected)
      }
      .tint(tint)
      .background(background)
    }
    .pickerDestination { screen in
      AuthPickerDestinationView(screen: screen)
        .tint(tint)
        .background(background)
    }
    .authTextFieldStyle(
      AuthTextFieldStyle(
        tint: tint,
        containerColor: container,
        secondaryColor: secondary,
        errorColor: error
      )
    )
    .authTypography(
      AuthTypography(fontFamily: "AmericanTypewriter")
    )
    .authCTAButtonStyle(
      AuthCTAButtonStyle(backgroundColor: tint, contentColor: .white, shape: .capsule)
    )
  }

Preview

Simulator Screenshot - iPhone 17 Pro - 2026-07-08 at 11 59 47

demolaf added 6 commits July 6, 2026 19:35
…tomize the auth sheet's root and destination content without breaking the existing initializer
…se remaining unstyled-text gaps across the auth flow
…ethodPicker:), with non-breaking AuthProviderAction dispatch for non-credential providers
@demolaf demolaf marked this pull request as draft July 8, 2026 11:00

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces extensive customization capabilities for the Firebase SwiftUI Auth UI components, including custom styling for CTA buttons, text fields, typography, and customizable picker content/destinations. The review feedback highlights critical compilation errors in AuthTextField.swift and VerificationCodeInputField.swift due to calling .strikethrough on a custom view modifier instead of directly on Text. Additionally, it points out visual inconsistencies where custom fonts are applied to placeholders but not to the typed text of SecureField and TextField components.

Comment on lines 157 to 161
Text(validator.message)
.font(.caption)
.strikethrough(isValid, color: .gray)
.foregroundStyle(isValid ? .gray : .red)
.authFont(.caption)
.strikethrough(isValid, color: style.secondaryColor ?? .gray)
.foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red))
.fixedSize(horizontal: false, vertical: true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This will cause a compilation error. .authFont(.caption) returns some View (since it is a custom view modifier), but .strikethrough is a modifier exclusive to Text. Calling .strikethrough on some View is not allowed. To fix this, apply .strikethrough directly to the Text view before applying .authFont.

Suggested change
Text(validator.message)
.font(.caption)
.strikethrough(isValid, color: .gray)
.foregroundStyle(isValid ? .gray : .red)
.authFont(.caption)
.strikethrough(isValid, color: style.secondaryColor ?? .gray)
.foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red))
.fixedSize(horizontal: false, vertical: true)
Text(validator.message)
.strikethrough(isValid, color: style.secondaryColor ?? .gray)
.authFont(.caption)
.foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red))
.fixedSize(horizontal: false, vertical: true)

Comment on lines 104 to 108
Text(validator.message)
.font(.caption)
.authFont(.caption)
.strikethrough(isValid, color: .gray)
.foregroundStyle(isValid ? .gray : .red)
.fixedSize(horizontal: false, vertical: true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This will cause a compilation error. .authFont(.caption) returns some View (since it is a custom view modifier), but .strikethrough is a modifier exclusive to Text. Calling .strikethrough on some View is not allowed. To fix this, apply .strikethrough directly to the Text view before applying .authFont.

Suggested change
Text(validator.message)
.font(.caption)
.authFont(.caption)
.strikethrough(isValid, color: .gray)
.foregroundStyle(isValid ? .gray : .red)
.fixedSize(horizontal: false, vertical: true)
Text(validator.message)
.strikethrough(isValid, color: .gray)
.authFont(.caption)
.foregroundStyle(isValid ? .gray : .red)
.fixedSize(horizontal: false, vertical: true)

Comment on lines +79 to 86
SecureField(label, text: $text, prompt: Text(prompt).font(typography.resolvedFont(for: .body)))
.opacity(obscured ? 1 : 0)
.focused($isFocused)
.frame(height: 24)
TextField(label, text: $text, prompt: Text(prompt))
TextField(label, text: $text, prompt: Text(prompt).font(typography.resolvedFont(for: .body)))
.opacity(obscured ? 0 : 1)
.focused($isFocused)
.frame(height: 24)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The custom font is explicitly applied to the placeholder (prompt) but not to the typed text of the SecureField and TextField themselves. This causes a visual inconsistency where the placeholder uses the custom font, but the user's typed input falls back to the system font. Applying .authFont(.body) directly to the text fields will style both the typed text and the placeholder consistently, allowing you to simplify the prompt parameter.

              SecureField(label, text: $text, prompt: Text(prompt))
                .authFont(.body)
                .opacity(obscured ? 1 : 0)
                .focused($isFocused)
                .frame(height: 24)
              TextField(label, text: $text, prompt: Text(prompt))
                .authFont(.body)
                .opacity(obscured ? 0 : 1)
                .focused($isFocused)
                .frame(height: 24)

Comment on lines 103 to 109
TextField(
label,
text: $text,
prompt: Text(prompt)
prompt: Text(prompt).font(typography.resolvedFont(for: .body))
)
.frame(height: 24)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The custom font is explicitly applied to the placeholder (prompt) but not to the typed text of the TextField itself. Applying .authFont(.body) directly to the TextField will style both the typed text and the placeholder consistently, allowing you to simplify the prompt parameter.

            TextField(
              label,
              text: $text,
              prompt: Text(prompt)
            )
            .authFont(.body)
            .frame(height: 24)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant