Skip to content

Commit

Permalink
Merge pull request #42 from hyperoslo/fix/swift4
Browse files Browse the repository at this point in the history
Update to Swift 4
  • Loading branch information
onmyway133 authored Oct 30, 2017
2 parents 10c76b4 + b7eb1b3 commit 1fffa1e
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 46 deletions.
4 changes: 0 additions & 4 deletions .slather.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "hyperoslo/Keychains" "1.0.0"
github "auth0/JWTDecode.swift" "2.0.0"
github "hyperoslo/Keychains" ~> 2.0
github "auth0/JWTDecode.swift" ~> 2.0
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "auth0/JWTDecode.swift" "2.0.0"
github "hyperoslo/Keychain" "1.0.0"
github "auth0/JWTDecode.swift" "2.1.1"
github "hyperoslo/Keychains" "2.0.0"
10 changes: 5 additions & 5 deletions OhMyAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OhMyAuth"
s.summary = "Simple OAuth2 library with a support of multiple services."
s.version = "1.2.0"
s.version = "2.0.0"
s.homepage = "https://github.com/hyperoslo/OhMyAuth"
s.license = 'MIT'
s.author = { "Hyper Interaktiv AS" => "[email protected]" }
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
}
s.social_media_url = 'https://twitter.com/hyperoslo'

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'

s.requires_arc = true
Expand All @@ -21,8 +21,8 @@ Pod::Spec.new do |s|
s.ios.frameworks = 'UIKit', 'Foundation'
s.osx.frameworks = 'Cocoa', 'Foundation'

s.dependency 'Keychains', '~> 1.0.0'
s.dependency 'JWTDecode', '~> 2.0.0'
s.dependency 'Keychains', '~> 2.0'
s.dependency 'JWTDecode', '~> 2.0'

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
end
24 changes: 15 additions & 9 deletions OhMyAuth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Hyper Interaktiv AS";
TargetAttributes = {
D5B2E89E1C3A780C00C0327D = {
Expand Down Expand Up @@ -615,14 +615,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 @@ -651,7 +657,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -666,14 +672,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 All @@ -695,7 +707,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -763,7 +775,6 @@
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.OhMyAuthTests;
PRODUCT_NAME = OhMyAuthTests;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -779,7 +790,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.OhMyAuthTests;
PRODUCT_NAME = OhMyAuthTests;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down Expand Up @@ -807,7 +817,6 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -834,7 +843,6 @@
PRODUCT_NAME = OhMyAuth;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -855,7 +863,6 @@
PRODUCT_NAME = OhMyAuthTests;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -875,7 +882,6 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.OhMyAuth-MacTests";
PRODUCT_NAME = OhMyAuthTests;
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
};
name = Release;
};
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
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
4 changes: 2 additions & 2 deletions Sources/Shared/AuthService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

@objc open class AuthService: NSObject {

public typealias Completion = (String?, NSError?) -> Void
public typealias Completion = (String?, Error?) -> Void

open let name: String
open let config: AuthConfig
Expand Down Expand Up @@ -169,7 +169,7 @@ import Foundation

switch result {
case .failure(let error):
completion(nil, error as? NSError)
completion(nil, error)
case .success(let accessToken):
completion(accessToken, nil)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Library/BrowserWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
#if os(iOS)
UIApplication.shared.openURL(URL)
#elseif os(OSX)
NSWorkspace.shared().open(URL)
NSWorkspace.shared.open(URL)
#endif
}
}
6 changes: 5 additions & 1 deletion Sources/Shared/Locker/KeychainLocker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import Keychains
let namedKey = generateKey(key)
let password = Keychain.password(forAccount: namedKey, service: service)

return !password.isEmpty ? password : nil
if let password = password, !password.isEmpty {
return password
}

return nil
}

func saveInKeychain(_ key: String, _ value: String?) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Protocols/NetworkRequestable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension NetworkRequestable {

guard error == nil
else {
if let error = error as? NSError {
if let error = error {
completion(Result.failure(error))
} else {
completion(Result.failure(OhMyAuthError.internalError.toNSError()))
Expand Down
16 changes: 16 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
machine:
xcode:
version: "9.0"

dependencies:
override:
- bin/bootstrap-if-needed
cache_directories:
- "Carthage"

test:
override:
- set -o pipefail && xcodebuild -project OhMyAuth.xcodeproj -scheme "OhMyAuth-Mac" -sdk macosx clean build
- set -o pipefail && xcodebuild -project OhMyAuth.xcodeproj -scheme "OhMyAuth-Mac" -sdk macosx -enableCodeCoverage YES test
- set -o pipefail && xcodebuild -project OhMyAuth.xcodeproj -scheme "OhMyAuth-iOS" -sdk iphonesimulator clean build
- set -o pipefail && xcodebuild -project OhMyAuth.xcodeproj -scheme "OhMyAuth-iOS" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.0.1' -enableCodeCoverage YES test

0 comments on commit 1fffa1e

Please sign in to comment.