@@ -18,7 +18,7 @@ FirebaseUI can be easily customized to fit in with the rest of your app's visual
1818 experience you want.
1919
2020Compatible 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/ ) .
2222
2323## Table of Contents
2424
@@ -59,7 +59,8 @@ import FirebaseAuthUI
5959/* ... */
6060
6161FIRApp.configure ()
62- let authUI = FIRAuthUI.defaultAuthUI ()
62+ let authUI = FIRAuthUI.default ()
63+ // You need to adopt a FIRAuthUIDelegate protocol to receive callback
6364authUI? .delegate = self
6465```
6566
@@ -70,7 +71,8 @@ authUI?.delegate = self
7071...
7172[FIRApp configure ];
7273FIRAuthUI *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;
7476```
7577
7678This 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:
7981// swift
8082import FirebaseGoogleAuthUI
8183import 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
8792```
8893
8994``` objective-c
9095// objc
9196@import FirebaseGoogleAuthUI
9297@import FirebaseFacebookAuthUI
98+ @import FIRTwitterAuthUI
9399...
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;
99106```
100107
101108For Google sign in support, add custom URL schemes to your Xcode project
@@ -110,9 +117,13 @@ Google/Facebook authentication process.
110117
111118``` swift
112119// 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
116127}
117128```
118129
@@ -138,7 +149,7 @@ present the `authViewController` obtain as instance as follows:
138149// Present the auth view controller and then implement the sign in callback.
139150let authViewController = authUI! .authViewController ()
140151
141- func authUI (authUI : FIRAuthUI, didSignInWithUser user : FIRUser? , error : ErrorType ? ) {
152+ func authUI (_ authUI : FIRAuthUI, didSignInWithUser user : FIRUser? , error : Error ? ) {
142153 // handle user and error as necessary
143154}
144155```
@@ -162,7 +173,8 @@ email/password account creation screen, can be specified as follows:
162173
163174``` swift
164175// swift
165- authUI? .TOSURL = NSURL (string : " https://example.com/tos" )!
176+ let kFirebaseTermsOfService = URL (string : " https://firebase.google.com/terms/" )!
177+ authUI? .tosurl = kFirebaseTermsOfService
166178```
167179
168180``` objective-c
@@ -187,7 +199,7 @@ authUI?.customStringsBundle = NSBundle.mainBundle() // Or any custom bundle.
187199authUI.customStringsBundle = [NSBundle mainBundle ]; // Or any custom bundle.
188200```
189201
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)
191203files that have the same names as the default files, namely ` FirebaseAuthUI ` ,
192204` FirebaseGoogleAuthUI ` , and ` FirebaseFacebookAuthUI ` . Each string in these files
193205should have the same key as its counterpart in the default ` .strings ` files.
@@ -204,7 +216,7 @@ subclass by implementing the delegate method
204216
205217``` swift
206218// swift
207- func authPickerViewControllerForAuthUI ( authUI : FIRAuthUI) -> FIRAuthPickerViewController {
219+ func authPickerViewController ( for authUI : FIRAuthUI) -> FIRAuthPickerViewController {
208220 return CustomAuthPickerViewController (authUI : authUI)
209221}
210222```
0 commit comments