File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed
samples/swift/FirebaseUI-demo-swift/Samples/Auth Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -21,18 +21,15 @@ import FirebaseAuth
2121class FUICustomAuthDelegate : NSObject , FUIAuthDelegate {
2222
2323 func authUI( _ authUI: FUIAuth , didSignInWith user: User ? , error: Error ? ) {
24- guard let authError = error else { return }
25-
26- let errorCode = UInt ( ( authError as NSError ) . code)
27-
28- switch errorCode {
29- case FUIAuthErrorCode . userCancelledSignIn. rawValue:
30- print ( " User cancelled sign-in " ) ;
31- break
32- default :
33- let detailedError = ( authError as NSError ) . userInfo [ NSUnderlyingErrorKey] ?? authError
34- print ( " Login error: \( ( detailedError as! NSError ) . localizedDescription) " ) ;
35- }
24+ switch error {
25+ case . some( let error as NSError ) where UInt ( error. code) == FUIAuthErrorCode . userCancelledSignIn. rawValue:
26+ print ( " User cancelled sign-in " )
27+ case . some( let error as NSError ) where error. userInfo [ NSUnderlyingErrorKey] != nil :
28+ print ( " Login error: \( error. userInfo [ NSUnderlyingErrorKey] !) " )
29+ case . some( let error) :
30+ print ( " Login error: \( error. localizedDescription) " )
31+ case . none:
32+ return
3633 }
3734
3835 func authPickerViewController( forAuthUI authUI: FUIAuth ) -> FUIAuthPickerViewController {
You can’t perform that action at this time.
0 commit comments