From 66e144a1f36cd9a3599976ce3fec1c73f94f63c4 Mon Sep 17 00:00:00 2001 From: Edward Jiang Date: Tue, 13 Sep 2016 16:19:09 -0700 Subject: [PATCH] updated deep link handling code --- README.md | 4 ++-- Simplicity.xcodeproj/project.pbxproj | 2 ++ Simplicity/Simplicity.swift | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7328b38..45239cb 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,11 @@ When a user finishes their log in flow, Facebook or Google will redirect back in ```Swift import Simplicity -func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { +func application(_ app: UIApplication, openURL url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool { return Simplicity.application(app, openURL: url, options: options) } -func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { +func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) -> Bool { return Simplicity.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } ``` diff --git a/Simplicity.xcodeproj/project.pbxproj b/Simplicity.xcodeproj/project.pbxproj index df32e05..14421cd 100644 --- a/Simplicity.xcodeproj/project.pbxproj +++ b/Simplicity.xcodeproj/project.pbxproj @@ -254,6 +254,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -298,6 +299,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Simplicity/Simplicity.swift b/Simplicity/Simplicity.swift index 0362da2..c641a50 100644 --- a/Simplicity/Simplicity.swift +++ b/Simplicity/Simplicity.swift @@ -31,11 +31,11 @@ public final class Simplicity { self.currentLoginProvider = loginProvider self.callback = callback - presentSafariView(loginProvider.authorizationURL as URL) + presentSafariView(loginProvider.authorizationURL) } /// Deep link handler (iOS9) - public static func application(_ app: UIApplication, openURL url: URL, options: [String : AnyObject]) -> Bool { + public static func application(_ app: UIApplication, openURL url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool { safari?.dismiss(animated: true, completion: nil) guard let callback = callback, url.scheme == currentLoginProvider?.urlScheme else { return false @@ -47,8 +47,8 @@ public final class Simplicity { } /// Deep link handler ( Bool { - return self.application(application, openURL: url, options: [String: AnyObject]()) + public static func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) -> Bool { + return self.application(application, openURL: url, options: [UIApplicationOpenURLOptionsKey: Any]()) } private static func presentSafariView(_ url: URL) {