Skip to content

docs: getting started for firebaseUI auth iOS for SwiftUI#1328

Draft
russellwheatley wants to merge 1 commit intomainfrom
getting-started-docs
Draft

docs: getting started for firebaseUI auth iOS for SwiftUI#1328
russellwheatley wants to merge 1 commit intomainfrom
getting-started-docs

Conversation

@russellwheatley
Copy link
Member

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new, dedicated getting started guide for FirebaseUI authentication tailored for SwiftUI applications. The document provides developers with clear, step-by-step instructions to integrate and configure various authentication methods, enabling them to quickly implement modern, SwiftUI-first sign-in experiences.

Highlights

  • New SwiftUI Getting Started Guide: A comprehensive guide for integrating FirebaseUI authentication with SwiftUI applications has been added, covering setup, various sign-in methods, and customization options.
  • Swift Package Manager Integration: Detailed instructions are provided for adding FirebaseUI for SwiftUI via Swift Package Manager, including core and provider-specific packages.
  • Multi-Provider Authentication Setup: The guide outlines how to configure and register multiple authentication providers such as Email/Password, Apple, Google, Facebook, Phone, Twitter, and generic OAuth/OIDC.
  • SwiftUI-First Sign-In Flows: Developers are guided on using AuthPickerView for opinionated default UI flows and AuthService for more custom authentication experiences.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new GETTING_STARTED.md documentation file for FirebaseUI for SwiftUI, detailing setup, authentication provider configuration, and usage examples. Review comments identify several issues and improvement opportunities within the provided Swift code snippets: a critical compilation error in the AppDelegate's application(_:open:options:) function due to a missing return statement, a potential runtime crash from force-unwrapping Bundle.main.bundleIdentifier, and a hardcoded APNS token type (.prod) that should ideally be conditional (.sandbox for debug builds). Additionally, the review suggests consolidating duplicated and incomplete AppDelegate examples to improve clarity and prevent confusion.

open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
Auth.auth().canHandle(url)

Choose a reason for hiding this comment

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

critical

This function is declared to return a Bool, but it's missing a return statement. This will cause a compilation error. You should return the boolean result from Auth.auth().canHandle(url).

Suggested change
Auth.auth().canHandle(url)
return Auth.auth().canHandle(url)

let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.url = URL(string: "https://yourapp.firebaseapp.com")
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)

Choose a reason for hiding this comment

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

medium

Force-unwrapping Bundle.main.bundleIdentifier with ! can cause a runtime crash if the value is nil. To promote safer coding practices in this guide, it's better to handle this optional gracefully. For example, you could use guard let to safely unwrap it and provide a clear error message if it's missing.

_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
Auth.auth().setAPNSToken(deviceToken, type: .prod)

Choose a reason for hiding this comment

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

medium

The code hardcodes the APNS token type to .prod, which is intended for production builds submitted to the App Store. During development and testing, the token type should be .sandbox. Using compiler directives to switch between the two based on the build configuration is a common practice and would make this example more robust for developers.

Suggested change
Auth.auth().setAPNSToken(deviceToken, type: .prod)
#if DEBUG
Auth.auth().setAPNSToken(deviceToken, type: .sandbox)
#else
Auth.auth().setAPNSToken(deviceToken, type: .prod)
#endif

Comment on lines +221 to +223
### Handle provider callbacks

If you use Google Sign-In, Facebook Login, phone authentication, or email link flows, add the required URL handling to your app delegate.

Choose a reason for hiding this comment

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

medium

This section provides a more complete implementation for handling provider callbacks, which is great. However, a different and incomplete version is provided earlier under the 'Phone number' section (lines 177-184), which also contains a compilation error. This duplication can be confusing. To improve clarity, consider consolidating the AppDelegate examples into a single, comprehensive section that developers can refer to for all provider-related URL handling.

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