Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Xcode 9 / Swift 3.2, Clean up for Swift 4 migration. #149

Merged
merged 2 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions Auth0.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1067,45 +1067,46 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Auth0;
TargetAttributes = {
5F06DD771CC448B10011842B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
5F06DD841CC448C90011842B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
5F06DD9F1CC451540011842B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
TestTargetID = 5F3965C61CF67DD800CDE7C0;
};
5F06DDAE1CC451700011842B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
5F23E6B81D4ACA7100C3F2D9 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0900;
};
5F23E6F51D4B87F000C3F2D9 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 86WQXF56BC;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
5F331AF81D4BB24C00AE4382 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
5F3965C61CF67DD800CDE7C0 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 86WQXF56BC;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
};
Expand Down Expand Up @@ -1587,14 +1588,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -1638,14 +1645,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -1700,6 +1713,7 @@
PRODUCT_NAME = Auth0;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand Down Expand Up @@ -1728,6 +1742,7 @@
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
PRODUCT_NAME = Auth0;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down Expand Up @@ -1758,6 +1773,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand Down Expand Up @@ -1787,6 +1803,7 @@
PRODUCT_NAME = Auth0;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Release;
Expand All @@ -1812,6 +1829,7 @@
PRODUCT_NAME = Auth0Tests;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.iOS-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2.app/OAuth2";
};
Expand All @@ -1837,6 +1855,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Auth0Tests;
PRODUCT_NAME = Auth0Tests;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.iOS-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2.app/OAuth2";
};
Expand All @@ -1863,6 +1882,7 @@
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.OSX-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -1887,6 +1907,7 @@
PRODUCT_NAME = Auth0Tests;
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.OSX-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Release;
Expand All @@ -1912,6 +1933,7 @@
PRODUCT_NAME = Auth0;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
Expand Down Expand Up @@ -1939,6 +1961,7 @@
PRODUCT_NAME = Auth0;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
Expand Down Expand Up @@ -1967,6 +1990,7 @@
PRODUCT_NAME = Auth0;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
Expand Down Expand Up @@ -1994,6 +2018,7 @@
PRODUCT_NAME = Auth0;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
Expand All @@ -2016,6 +2041,7 @@
PRODUCT_MODULE_NAME = Auth0Tests;
PRODUCT_NAME = Auth0Tests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -2037,6 +2063,7 @@
PRODUCT_MODULE_NAME = Auth0Tests;
PRODUCT_NAME = Auth0Tests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -2060,6 +2087,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "985e6d6d-fbce-4715-b23c-d991b94b6d9c";
PROVISIONING_PROFILE_SPECIFIER = "match Development com.auth0.OAuth2";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -2080,6 +2108,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.OAuth2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
4 changes: 3 additions & 1 deletion Auth0.xcodeproj/xcshareddata/xcschemes/Auth0.iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
14 changes: 7 additions & 7 deletions Auth0/Credentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ import Foundation
public class Credentials: NSObject, JSONObjectPayload, NSSecureCoding {

/// Token used that allows calling to the requested APIs (audience sent on Auth)
public let accessToken: String?
@objc public let accessToken: String?
/// Type of the access token
public let tokenType: String?
@objc public let tokenType: String?
/// When the access_token expires
public let expiresIn: Date?
@objc public let expiresIn: Date?
/// If the API allows you to request new access tokens and the scope `offline_access` was included on Auth
public let refreshToken: String?
@objc public let refreshToken: String?
// Token that details the user identity after authentication
public let idToken: String?
@objc public let idToken: String?
// Granted scopes, only populated when a requested scope or scopes was not granted and Auth is OIDC Conformant
public let scope: String?
@objc public let scope: String?

public init(accessToken: String? = nil, tokenType: String? = nil, idToken: String? = nil, refreshToken: String? = nil, expiresIn: Date? = nil, scope: String? = nil) {
@objc public init(accessToken: String? = nil, tokenType: String? = nil, idToken: String? = nil, refreshToken: String? = nil, expiresIn: Date? = nil, scope: String? = nil) {
self.accessToken = accessToken
self.tokenType = tokenType
self.idToken = idToken
Expand Down
22 changes: 11 additions & 11 deletions Auth0/Identity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ import Foundation
@objc(A0Identity)
public class Identity: NSObject, JSONObjectPayload {

public let identifier: String
public let provider: String
public let connection: String
@objc public let identifier: String
@objc public let provider: String
@objc public let connection: String

public let social: Bool
public let profileData: [String: Any]
@objc public let social: Bool
@objc public let profileData: [String: Any]

public let accessToken: String?
public let expiresIn: Date?
public let accessTokenSecret: String?
@objc public let accessToken: String?
@objc public let expiresIn: Date?
@objc public let accessTokenSecret: String?

override public var debugDescription: String {
@objc override public var debugDescription: String {
return "<identity: \(identifier) provider: \(provider) connection: \(connection)>"
}

public required init(identifier: String, provider: String, connection: String, social: Bool, profileData: [String: Any], accessToken: String?, expiresIn: Date?, accessTokenSecret: String?) {
@objc public required init(identifier: String, provider: String, connection: String, social: Bool, profileData: [String: Any], accessToken: String?, expiresIn: Date?, accessTokenSecret: String?) {
self.identifier = identifier
self.provider = provider
self.connection = connection
Expand All @@ -54,7 +54,7 @@ public class Identity: NSObject, JSONObjectPayload {
self.accessTokenSecret = accessTokenSecret
}

convenience public required init?(json: [String : Any]) {
@objc convenience public required init?(json: [String : Any]) {

guard
let identifier = json["user_id"] as? String,
Expand Down
4 changes: 2 additions & 2 deletions Auth0/NSError+Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
import Foundation

public extension NSError {
public var a0_isManagementError: Bool { return self.domain == ManagementError.errorDomain }
public var a0_isAuthenticationError: Bool { return self.domain == AuthenticationError.errorDomain }
@objc public var a0_isManagementError: Bool { return self.domain == ManagementError.errorDomain }
@objc public var a0_isAuthenticationError: Bool { return self.domain == AuthenticationError.errorDomain }
}
6 changes: 3 additions & 3 deletions Auth0/_ObjectiveAuthenticationAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public class _ObjectiveAuthenticationAPI: NSObject {

private var authentication: Authentication

public override init () {
@objc public override init () {
self.authentication = Auth0.authentication()
}

public convenience init(clientId: String, url: URL) {
@objc public convenience init(clientId: String, url: URL) {
self.init(clientId: clientId, url: url, session: .shared)
}

public init(clientId: String, url: URL, session: URLSession) {
@objc public init(clientId: String, url: URL, session: URLSession) {
self.authentication = Auth0Authentication(clientId: clientId, url: url, session: session)
}

Expand Down
Loading