From eebeb20e5ceb3d2d4611263bcd949b67aae791a8 Mon Sep 17 00:00:00 2001 From: Sangjoon-Moon Date: Thu, 4 Aug 2016 16:41:50 +0900 Subject: [PATCH 1/2] fix the optional error with the optional binding --- samples/swift/uidemo/AppDelegate.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/samples/swift/uidemo/AppDelegate.swift b/samples/swift/uidemo/AppDelegate.swift index 622c92f3981..39902b4cb58 100644 --- a/samples/swift/uidemo/AppDelegate.swift +++ b/samples/swift/uidemo/AppDelegate.swift @@ -35,9 +35,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { - let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String? - if FIRAuthUI.authUI()?.handleOpenURL(url, sourceApplication: sourceApplication) ?? false { - return true + if let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String? { + if FIRAuthUI.authUI()?.handleOpenURL(url, sourceApplication: sourceApplication) ?? false { + return true + } } // other URL handling goes here. return false From a5197f61ac5c00a59853196e9c0b7f7299dae518 Mon Sep 17 00:00:00 2001 From: Sangjoon-Moon Date: Wed, 10 Aug 2016 23:51:30 +0900 Subject: [PATCH 2/2] remove the optional binding use nil coalescing operator for sourceApplication argument. --- samples/swift/uidemo/AppDelegate.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/swift/uidemo/AppDelegate.swift b/samples/swift/uidemo/AppDelegate.swift index 39902b4cb58..f9883291fd2 100644 --- a/samples/swift/uidemo/AppDelegate.swift +++ b/samples/swift/uidemo/AppDelegate.swift @@ -35,10 +35,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { - if let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String? { - if FIRAuthUI.authUI()?.handleOpenURL(url, sourceApplication: sourceApplication) ?? false { - return true - } + let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String? + if FIRAuthUI.authUI()?.handleOpenURL(url, sourceApplication: sourceApplication ?? "") ?? false { + return true } // other URL handling goes here. return false