Skip to content

Commit

Permalink
Upgrade to Swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
tmandry committed Oct 21, 2017
1 parent 964260e commit 34f90ef
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 69 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -6,6 +6,5 @@ cache: cocoapods
xcode_workspace: Swindler.xcworkspace
xcode_scheme: Swindler

osx_image: xcode8.3
xcode_sdk: macosx10.12
script: xcodebuild -workspace Swindler.xcworkspace -scheme Swindler -sdk macosx10.12 build test
osx_image: xcode9
script: xcodebuild -workspace Swindler.xcworkspace -scheme Swindler build test
8 changes: 4 additions & 4 deletions Podfile
Expand Up @@ -5,8 +5,8 @@ platform :osx, '10.10'
use_frameworks!

def testing_pods
pod 'Quick', '~> 1.1.0'
pod 'Nimble', '~> 7.0.0'
pod 'Quick', '~> 1.2.0'
pod 'Nimble', '~> 7.0.2'
end

project 'Swindler'
Expand All @@ -15,11 +15,11 @@ target 'SwindlerTests' do
end

target 'Swindler' do
pod 'PromiseKit', '~> 4.2.0'
pod 'PromiseKit', '4.4.0'
pod 'AXSwift', path: './AXSwift'
end

target 'SwindlerExample' do
pod 'PromiseKit/CorePromise', '~> 4.2.0'
pod 'PromiseKit/CorePromise', '4.4.0'
pod 'AXSwift', path: './AXSwift'
end
36 changes: 18 additions & 18 deletions Podfile.lock
@@ -1,36 +1,36 @@
PODS:
- AXSwift (0.1.3)
- Nimble (7.0.0)
- PromiseKit (4.2.2):
- PromiseKit/Foundation (= 4.2.2)
- PromiseKit/QuartzCore (= 4.2.2)
- PromiseKit/UIKit (= 4.2.2)
- PromiseKit/CorePromise (4.2.2)
- PromiseKit/Foundation (4.2.2):
- Nimble (7.0.2)
- PromiseKit (4.4.0):
- PromiseKit/Foundation (= 4.4.0)
- PromiseKit/QuartzCore (= 4.4.0)
- PromiseKit/UIKit (= 4.4.0)
- PromiseKit/CorePromise (4.4.0)
- PromiseKit/Foundation (4.4.0):
- PromiseKit/CorePromise
- PromiseKit/QuartzCore (4.2.2):
- PromiseKit/QuartzCore (4.4.0):
- PromiseKit/CorePromise
- PromiseKit/UIKit (4.2.2):
- PromiseKit/UIKit (4.4.0):
- PromiseKit/CorePromise
- Quick (1.1.0)
- Quick (1.2.0)

DEPENDENCIES:
- AXSwift (from `./AXSwift`)
- Nimble (~> 7.0.0)
- PromiseKit (~> 4.2.0)
- PromiseKit/CorePromise (~> 4.2.0)
- Quick (~> 1.1.0)
- Nimble (~> 7.0.2)
- PromiseKit (= 4.4.0)
- PromiseKit/CorePromise (= 4.4.0)
- Quick (~> 1.2.0)

EXTERNAL SOURCES:
AXSwift:
:path: ./AXSwift

SPEC CHECKSUMS:
AXSwift: 3158333c4bed500f2b9811c6f786466be7ef278a
Nimble: 874982b605d4d752fcac6be695d13c502de84b1b
PromiseKit: 00e8886881f151c7e573d06b437915b0bb2970ec
Quick: dafc587e21eed9f4cab3249b9f9015b0b7a7f71d
Nimble: bfe1f814edabba69ff145cb1283e04ed636a67f2
PromiseKit: ecf5fe92275d57ee77c9ede858af47a162e9b97e
Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08

PODFILE CHECKSUM: bb8bb67946361042c7d533b3c72a5b5936a26de3
PODFILE CHECKSUM: f57fe185c97fd2163860e680117807ea2df92ffd

COCOAPODS: 1.3.1
33 changes: 25 additions & 8 deletions Swindler.xcodeproj/project.pbxproj
Expand Up @@ -333,19 +333,20 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Tyler Mandry";
TargetAttributes = {
2F86CEC51BD60117007E8C29 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0830;
LastSwiftMigration = 0900;
};
2F86CECF1BD60117007E8C29 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0830;
};
2F86CEE81BD6EC32007E8C29 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -604,14 +605,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 @@ -653,14 +660,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 @@ -706,7 +719,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Swindler";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -729,7 +743,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Swindler";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -743,7 +758,7 @@
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DSWINDLER_LOG_INFO";
PRODUCT_BUNDLE_IDENTIFIER = com.tylermandry.SwindlerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -757,7 +772,7 @@
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DSWINDLER_LOG_INFO";
PRODUCT_BUNDLE_IDENTIFIER = com.tylermandry.SwindlerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -771,7 +786,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tylermandry.SwindlerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -785,7 +801,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tylermandry.SwindlerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 3 additions & 1 deletion Swindler.xcodeproj/xcshareddata/xcschemes/Swindler.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
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
2 changes: 1 addition & 1 deletion Swindler/Application.swift
Expand Up @@ -77,7 +77,7 @@ protocol ApplicationDelegate: class {

/// Implements ApplicationDelegate using the AXUIElement API.
final class OSXApplicationDelegate<
UIElement: UIElementType,
UIElement,
ApplicationElement: ApplicationElementType,
Observer: ObserverType
>: ApplicationDelegate, PropertyNotifier
Expand Down
4 changes: 2 additions & 2 deletions Swindler/Property.swift
Expand Up @@ -77,7 +77,7 @@ public struct OfType<T: Equatable>: PropertyTypeSpec {
public static func toPropertyType(_ from: T?) throws -> T {
guard let to: T = from else {
// TODO: unexpected error
log.error("Cannot convert property value \(from) to type \(T.self)")
log.error("Cannot convert property value \(String(describing: from)) to type \(T.self)")
throw PropertyError.invalidObject(cause: PropertyError.missingValue)
}
return to
Expand Down Expand Up @@ -138,7 +138,7 @@ open class Property<TypeSpec: PropertyTypeSpec> {

delegate.initialize().then { (value: OptionalType) -> Void in
self.value_ = try TypeSpec.toPropertyType(value)
fulfill()
fulfill(())
}.catch { error in
do {
try self.handleError(error)
Expand Down
4 changes: 2 additions & 2 deletions Swindler/Screen.swift
Expand Up @@ -35,7 +35,7 @@ protocol ScreenDelegate: class, CustomDebugStringConvertible {
protocol NSScreenType {
var frame: CGRect { get }
var visibleFrame: CGRect { get }
var deviceDescription: [String: Any] { get }
var deviceDescription: [NSDeviceDescriptionKey: Any] { get }

var displayName: String { get }
}
Expand Down Expand Up @@ -141,7 +141,7 @@ extension OSXScreenDelegate {

private func numberForScreen<NSScreenT: NSScreenType>(_ nsScreen: NSScreenT) -> CGDirectDisplayID {
// Get the direct display ID. This is documented to always exist.
let screenNumber = nsScreen.deviceDescription[kNSScreenNumber]!
let screenNumber = nsScreen.deviceDescription[NSDeviceDescriptionKey(kNSScreenNumber)]!
return CGDirectDisplayID((screenNumber as! NSNumber).intValue)
}

Expand Down

0 comments on commit 34f90ef

Please sign in to comment.