@@ -18,7 +18,7 @@ FirebaseUI can be easily customized to fit in with the rest of your app's visual
18
18
experience you want.
19
19
20
20
Compatible FirebaseUI clients are also available for [ Android] ( https://github.com/firebase/firebaseui-android/tree/master/auth )
21
- and [ Web] ( https://github.com/firebase/firebaseui-web/tree/master/auth ) .
21
+ and [ Web] ( https://github.com/firebase/firebaseui-web/ ) .
22
22
23
23
## Table of Contents
24
24
@@ -59,7 +59,8 @@ import FirebaseAuthUI
59
59
/* ... */
60
60
61
61
FIRApp.configure ()
62
- let authUI = FIRAuthUI.defaultAuthUI ()
62
+ let authUI = FIRAuthUI.default ()
63
+ // You need to adopt a FIRAuthUIDelegate protocol to receive callback
63
64
authUI? .delegate = self
64
65
```
65
66
@@ -70,7 +71,8 @@ authUI?.delegate = self
70
71
...
71
72
[FIRApp configure ];
72
73
FIRAuthUI *authUI = [FIRAuthUI defaultAuthUI ];
73
- authUI.delegate = self; // Set the delegate to receive callback.
74
+ // You need to adopt a FIRAuthUIDelegate protocol to receive callback
75
+ authUI.delegate = self;
74
76
```
75
77
76
78
This instance can then be configured with the providers you wish to support:
@@ -79,23 +81,28 @@ This instance can then be configured with the providers you wish to support:
79
81
// swift
80
82
import FirebaseGoogleAuthUI
81
83
import FirebaseFacebookAuthUI
82
-
83
- let googleAuthUI = FIRGoogleAuthUI (clientID : kGoogleClientID)
84
- let facebookAuthUI = FIRFacebookAuthUI (appID : kFacebookAppID)
85
-
86
- authUI? .providers = [googleAuthUI, facebookAuthUI]
84
+ import FirebaseTwitterAuthUI
85
+
86
+ let providers: [FIRAuthProviderUI] = [
87
+ FIRGoogleAuthUI (),
88
+ FIRFacebookAuthUI (),
89
+ FIRTwitterAuthUI (),
90
+ ]
91
+ self .authUI ? .providers = providers
87
92
```
88
93
89
94
``` objective-c
90
95
// objc
91
96
@import FirebaseGoogleAuthUI
92
97
@import FirebaseFacebookAuthUI
98
+ @import FIRTwitterAuthUI
93
99
...
94
- FIRGoogleAuthUI *googleAuthUI =
95
- [[FIRGoogleAuthUI alloc ] initWithClientID: kGoogleClientID] ;
96
- FIRFacebookAuthUI * facebookAuthUI =
97
- [[ FIRFacebookAuthUI alloc] initWithAppID: kFacebookAppID ] ;
98
- authUI.signInProviders = @[ googleAuthUI, facebookAuthUI] ;
100
+ NSArray <id <FIRAuthProviderUI>> *providers = @[
101
+ [[FIRGoogleAuthUI alloc ] init ],
102
+ [[FIRFacebookAuthUI alloc ] init ],
103
+ [[FIRTwitterAuthUI alloc ] init ],
104
+ ];
105
+ _authUI.providers = providers;
99
106
```
100
107
101
108
For Google sign in support, add custom URL schemes to your Xcode project
@@ -110,9 +117,13 @@ Google/Facebook authentication process.
110
117
111
118
``` swift
112
119
// swift
113
- func application(app: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool {
114
- let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String
115
- return FIRAuthUI.defaultAuthUI()?.handleOpenURL(url, sourceApplication: sourceApplication ?? "") ?? false
120
+ func application (_ app : UIApplication, open url : URL, options : [UIApplicationOpenURLOptionsKey : Any ]) -> Bool {
121
+ let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication ] as! String ?
122
+ if FIRAuthUI.default ()? .handleOpen (url, sourceApplication : sourceApplication) ?? false {
123
+ return true
124
+ }
125
+ // other URL handling goes here.
126
+ return false
116
127
}
117
128
```
118
129
@@ -138,7 +149,7 @@ present the `authViewController` obtain as instance as follows:
138
149
// Present the auth view controller and then implement the sign in callback.
139
150
let authViewController = authUI! .authViewController ()
140
151
141
- func authUI (authUI : FIRAuthUI, didSignInWithUser user : FIRUser? , error : ErrorType ? ) {
152
+ func authUI (_ authUI : FIRAuthUI, didSignInWithUser user : FIRUser? , error : Error ? ) {
142
153
// handle user and error as necessary
143
154
}
144
155
```
@@ -162,7 +173,8 @@ email/password account creation screen, can be specified as follows:
162
173
163
174
``` swift
164
175
// swift
165
- authUI? .TOSURL = NSURL (string : " https://example.com/tos" )!
176
+ let kFirebaseTermsOfService = URL (string : " https://firebase.google.com/terms/" )!
177
+ authUI? .tosurl = kFirebaseTermsOfService
166
178
```
167
179
168
180
``` objective-c
@@ -187,7 +199,7 @@ authUI?.customStringsBundle = NSBundle.mainBundle() // Or any custom bundle.
187
199
authUI.customStringsBundle = [NSBundle mainBundle ]; // Or any custom bundle.
188
200
```
189
201
190
- The bundle should include [ .strings] ( Auth/AuthUI /Strings/en.lproj/FirebaseAuthUI.strings)
202
+ The bundle should include [ .strings] ( https://github.com/firebase/FirebaseUI-iOS/blob/master/FirebaseAuthUI /Strings/en.lproj/FirebaseAuthUI.strings)
191
203
files that have the same names as the default files, namely ` FirebaseAuthUI ` ,
192
204
` FirebaseGoogleAuthUI ` , and ` FirebaseFacebookAuthUI ` . Each string in these files
193
205
should have the same key as its counterpart in the default ` .strings ` files.
@@ -204,7 +216,7 @@ subclass by implementing the delegate method
204
216
205
217
``` swift
206
218
// swift
207
- func authPickerViewControllerForAuthUI ( authUI : FIRAuthUI) -> FIRAuthPickerViewController {
219
+ func authPickerViewController ( for authUI : FIRAuthUI) -> FIRAuthPickerViewController {
208
220
return CustomAuthPickerViewController (authUI : authUI)
209
221
}
210
222
```
0 commit comments