Skip to content

Commit 7926c5d

Browse files
docs: update email and phone auth sign in
1 parent b38cf42 commit 7926c5d

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

FirebaseSwiftUI/README.md

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -767,27 +767,23 @@ Creates a new `AuthService` instance.
767767
##### Email Authentication
768768

769769
```swift
770-
public func withEmailSignIn() -> AuthService
770+
public func withEmailSignIn(_ provider: EmailProviderSwift? = nil, onTap: @escaping () -> Void) -> AuthService
771771
```
772772

773-
Enables email/password and email link authentication and will register an email button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`. Uses default behavior (navigates to email link view when tapped).
773+
Enables email authentication and will render email sign-in directly within the AuthPickerView (default Views), email link sign-in is rendered as a button. When calling `AuthService.renderButtons()`, email link sign-in button is rendered. `onTap` custom callback (i.e where to navigate when tapped) allows user to control what happens when tapped. Default behavior in AuthPickerView is to push the user to email link sign-in default View.
774+
775+
**Parameters:**
776+
- `provider`: An optional instance of `EmailProviderSwift`. If not provided, a default instance will be created.
777+
- `onTap`: A callback that will be executed when the email button is tapped.
774778

775779
**Example:**
776780

777781
```swift
778782
authService
779783
.withEmailSignIn()
780-
```
781-
782-
```swift
783-
public func withEmailSignIn(onTap: @escaping () -> Void) -> AuthService
784-
```
785-
786-
Enables email authentication and will register an email button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`. Uses a custom callback (i.e where to navigate when tapped) when the email button is tapped.
787784

788-
**Example:**
785+
// or
789786

790-
```swift
791787
authService
792788
.withEmailSignIn(){
793789
// navigate to email sign-in screen logic
@@ -799,30 +795,24 @@ authService
799795
##### Phone Authentication
800796

801797
```swift
802-
// Available when importing FirebasePhoneAuthSwiftUI
803-
public func withPhoneSignIn() -> AuthService
798+
public func withPhoneSignIn(onTap: @escaping () -> Void) -> AuthService
804799
```
805800

806-
Enables phone number authentication with SMS verification and will register a phone button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`. Uses default behavior (navigates to enter phone number view when tapped).
801+
Enables phone number authentication with SMS verification and will register a phone button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`. `onTap` custom callback (i.e where to navigate when tapped) allows user to control what happens when tapped. Default behavior in AuthPickerView is to push the user to phone sign-in default View.
802+
803+
**Parameters:**
804+
- `onTap`: A callback that will be executed when the phone button is tapped.
807805

808806
**Example:**
809807

810808
```swift
811809
authService
812810
.withPhoneSignIn()
813-
```
814-
815-
```swift
816-
public func withPhoneSignIn(onTap: @escaping () -> Void) -> AuthService
817-
```
818811

819-
Enables phone authentication and will register a phone button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`. Uses a custom callback (i.e where to navigate when tapped) when the phone button is tapped.
812+
// or
820813

821-
**Example:**
822-
823-
```swift
824814
authService
825-
.withPhoneSignIn(){
815+
.withPhoneSignIn() {
826816
// navigate to phone sign-in screen logic
827817
}
828818
```
@@ -875,19 +865,19 @@ authService
875865

876866
```swift
877867
// Available when importing FirebaseFacebookSwiftUI
878-
public func withFacebookSignIn(_ provider: FacebookProviderSwift) -> AuthService
868+
public func withFacebookSignIn(_ provider: FacebookProviderSwift? = nil) -> AuthService
879869
```
880870

881871
Enables Sign in with Facebook authentication and will register a Facebook button that is rendered in AuthPickerView (default Views) or can be rendered in custom Views by calling `AuthService.renderButtons()`.
882872

883873
**Parameters:**
884-
- `provider`: An instance of `FacebookProviderSwift()` for classic login or `FacebookProviderSwift(useClassicLogin: false)` for limited login.
874+
- `provider`: An optional instance of `FacebookProviderSwift()` for classic login or `FacebookProviderSwift(useClassicLogin: false)` for limited login. If not provided, a default instance with classic login will be created.
885875

886876
**Example:**
887877

888878
```swift
889879
authService
890-
.withFacebookSignIn(FacebookProviderSwift())
880+
.withFacebookSignIn()
891881
```
892882

893883
---
@@ -1061,7 +1051,7 @@ Signs in using email and password credentials.
10611051
##### Create User with Email/Password
10621052

10631053
```swift
1064-
public func createUser(email: String, password: String) async throws -> SignInOutcome
1054+
public func createUser(email email: String, password: String) async throws -> SignInOutcome
10651055
```
10661056

10671057
Creates a new user account with email and password.
@@ -1101,7 +1091,7 @@ Button("Sign Out") {
11011091
##### Link Accounts
11021092

11031093
```swift
1104-
public func linkAccounts(credentials: AuthCredential) async throws
1094+
public func linkAccounts(credentials credentials: AuthCredential) async throws
11051095
```
11061096

11071097
Links a new authentication method to the current user's account.
@@ -1135,7 +1125,7 @@ Sends a sign-in link to the specified email address.
11351125
##### Handle Sign-In Link
11361126

11371127
```swift
1138-
public func handleSignInLink(url: URL) async throws
1128+
public func handleSignInLink(url url: URL) async throws
11391129
```
11401130

11411131
Handles the sign-in flow when the user taps the email link.

0 commit comments

Comments
 (0)