diff --git a/.swift-version b/.swift-version index 9f55b2c..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Simplicity.podspec b/Simplicity.podspec index 0b5ed00..3312bbc 100644 --- a/Simplicity.podspec +++ b/Simplicity.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |s| s.name = "Simplicity" -s.version = "2.0.1" +s.version = "2.0.4" s.summary = "A simple way to login with Facebook or Google on iOS" s.description = <<-DESC @@ -15,13 +15,13 @@ Simplicity can be easily extended to support other external login providers, inc DESC -s.homepage = "https://github.com/SimplicityMobile/Simplicity" +s.homepage = "https://github.com/ppaulojr/Simplicity" s.license = 'Apache 2.0' s.author = { "Edward Jiang" => "edward@stormpath.com" } -s.source = { :git => "https://github.com/SimplicityMobile/Simplicity.git", :tag => s.version.to_s } +s.source = { :git => "https://github.com/ppaulojr/Simplicity.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/EdwardStarcraft' -s.ios.deployment_target = '8.0' +s.ios.deployment_target = '9.0' s.source_files = 'Simplicity/**/*.swift' diff --git a/Simplicity.xcodeproj/project.pbxproj b/Simplicity.xcodeproj/project.pbxproj index 14421cd..1ccdd37 100644 --- a/Simplicity.xcodeproj/project.pbxproj +++ b/Simplicity.xcodeproj/project.pbxproj @@ -165,6 +165,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = DF74EC261CE2A8BB008F16BF; @@ -254,7 +255,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -299,7 +300,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -318,13 +319,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Simplicity/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.stormpath.Simplicity; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -339,12 +340,12 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Simplicity/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.stormpath.Simplicity; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Simplicity/Helpers.swift b/Simplicity/Helpers.swift index 5718a8b..244d717 100644 --- a/Simplicity/Helpers.swift +++ b/Simplicity/Helpers.swift @@ -23,9 +23,9 @@ class Helpers { } // Convert the complex dictionary into an array of URL schemes - let urlSchemes = urlTypes.flatMap({($0["CFBundleURLSchemes"] as? [String])?.first }) + let urlSchemes = urlTypes.compactMap({($0["CFBundleURLSchemes"] as? [String])?.first }) - return urlSchemes.flatMap({closure($0) ? $0 : nil}) + return urlSchemes.compactMap({closure($0) ? $0 : nil}) } /** @@ -36,7 +36,7 @@ class Helpers { - returns: A query string */ static func queryString(_ parts: [String: String?]) -> String? { - return parts.flatMap { key, value -> String? in + return parts.compactMap { key, value -> String? in if let value = value { return key + "=" + value } else { diff --git a/Simplicity/LoginProviders/Facebook.swift b/Simplicity/LoginProviders/Facebook.swift index 1bea523..4ccaa5b 100644 --- a/Simplicity/LoginProviders/Facebook.swift +++ b/Simplicity/LoginProviders/Facebook.swift @@ -53,7 +53,7 @@ public class Facebook: OAuth2 { let range = urlScheme.range(of: "\\d+", options: .regularExpression) else { preconditionFailure("You must configure your Facebook URL Scheme to use Facebook login.") } - let clientId = urlScheme.substring(with: range) + let clientId = String(urlScheme[range]) let authorizationEndpoint = URL(string: "https://www.facebook.com/dialog/oauth")! let redirectEndpoint = URL(string: urlScheme + "://authorize")! diff --git a/Simplicity/LoginProviders/VKontakte.swift b/Simplicity/LoginProviders/VKontakte.swift index 997c65b..7cb460f 100644 --- a/Simplicity/LoginProviders/VKontakte.swift +++ b/Simplicity/LoginProviders/VKontakte.swift @@ -33,7 +33,7 @@ public class VKontakte: OAuth2 { let range = urlScheme.range(of: "\\d+", options: .regularExpression) else { preconditionFailure("You must configure your VK URL Scheme to use VK login.") } - let clientId = urlScheme.substring(with: range) + let clientId = String(urlScheme[range]) let authorizationEndpoint = URL(string: "https://oauth.vk.com/authorize")! let redirectEndpoint = URL(string: urlScheme + "://authorize")! diff --git a/Simplicity/OAuth2.swift b/Simplicity/OAuth2.swift index f6d3e47..400613c 100644 --- a/Simplicity/OAuth2.swift +++ b/Simplicity/OAuth2.swift @@ -64,7 +64,7 @@ public class OAuth2: LoginProvider { var url = URLComponents(url: authorizationEndpoint, resolvingAgainstBaseURL: false)! - url.queryItems = authorizationURLParameters.flatMap({key, value -> URLQueryItem? in + url.queryItems = authorizationURLParameters.compactMap({key, value -> URLQueryItem? in return value != nil ? URLQueryItem(name: key, value: value) : nil }) diff --git a/Simplicity/Simplicity.swift b/Simplicity/Simplicity.swift index 347a888..3f7deea 100644 --- a/Simplicity/Simplicity.swift +++ b/Simplicity/Simplicity.swift @@ -35,7 +35,7 @@ public final class Simplicity { } /// Deep link handler (iOS9) - public static func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool { + public static func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool { safari?.dismiss(animated: true, completion: nil) guard let callback = callback, url.scheme == currentLoginProvider?.urlScheme else { return false @@ -48,7 +48,7 @@ public final class Simplicity { /// Deep link handler ( Bool { - return self.application(application, open: url, options: [UIApplicationOpenURLOptionsKey: Any]()) + return self.application(application, open: url, options: [UIApplication.OpenURLOptionsKey: Any]()) } private static func presentSafariView(_ url: URL) {