From c1d4bca327e0300fa5cccb20836f809d4b6a0d15 Mon Sep 17 00:00:00 2001 From: Bernard Gatt Date: Wed, 29 Mar 2017 01:12:09 +0200 Subject: [PATCH 1/3] Fixes issues with Xcode 8.3 and Swift 3.1 --- StyleKit/Stylist.swift | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/StyleKit/Stylist.swift b/StyleKit/Stylist.swift index c7d3a74..15a7d49 100644 --- a/StyleKit/Stylist.swift +++ b/StyleKit/Stylist.swift @@ -33,7 +33,7 @@ class Stylist { SKTryCatch.try( { self.validateAndApply(self.data) }, catch: { exception in - SKLogger.severe("There was an error while applying styles: \(exception)") + SKLogger.severe("There was an error while applying styles: \(exception.debugDescription)") }, finallyBlock: nil) } @@ -58,7 +58,7 @@ class Stylist { SKLogger.error("Style \(value) not applied on \(key) for \(self.currentComponent.debugDescription)") } }, catch: { exception in - SKLogger.error("Style \(value) not applied on \(key) for \(self.currentComponent.debugDescription) Error \(exception)") + SKLogger.error("Style \(value) not applied on \(key) for \(self.currentComponent.debugDescription) Error \(exception.debugDescription)") }, finallyBlock: nil) } } @@ -135,38 +135,38 @@ class Stylist { if valueOne == nil && valueTwo == nil { if isViewStackRelevant { if #available(iOS 9.0, *) { - _ = self.currentComponent?.appearance(whenContainedInInstancesOf: viewStack).perform(Selector(modifiedSelector)) + _ = (self.currentComponent!.appearance(whenContainedInInstancesOf: viewStack) as! NSObject).perform(Selector(modifiedSelector)) } else { - _ = self.currentComponent?.styleKitAppearanceWhenContained(within: viewStack).perform(Selector(modifiedSelector)) + _ = (self.currentComponent!.styleKitAppearanceWhenContained(within: viewStack) as! NSObject).perform(Selector(modifiedSelector)) } } else { - _ = self.currentComponent?.appearance().perform(Selector(modifiedSelector)) + _ = (self.currentComponent!.appearance() as! NSObject).perform(Selector(modifiedSelector)) } } else if valueOne != nil && valueTwo != nil { if isViewStackRelevant { if #available(iOS 9.0, *) { - let methodSignature = self.currentComponent!.appearance(whenContainedInInstancesOf: viewStack).method(for: Selector(modifiedSelector)) + let methodSignature = (self.currentComponent!.appearance(whenContainedInInstancesOf: viewStack) as! NSObject).method(for: Selector(modifiedSelector)) let callback = unsafeBitCast(methodSignature, to: setValueForControlState.self) callback(self.currentComponent!.appearance(whenContainedInInstancesOf: viewStack), Selector(modifiedSelector), valueOne!, valueTwo as! UInt) } else { - let methodSignature = self.currentComponent!.styleKitAppearanceWhenContained(within: viewStack).method(for: Selector(modifiedSelector)) + let methodSignature = (self.currentComponent!.styleKitAppearanceWhenContained(within: viewStack) as! NSObject).method(for: Selector(modifiedSelector)) let callback = unsafeBitCast(methodSignature, to: setValueForControlState.self) callback(self.currentComponent!.styleKitAppearanceWhenContained(within: viewStack), Selector(modifiedSelector), valueOne!, valueTwo as! UInt) } } else { - let methodSignature = self.currentComponent!.appearance().method(for: Selector(modifiedSelector)) + let methodSignature = (self.currentComponent!.appearance() as! NSObject).method(for: Selector(modifiedSelector)) let callback = unsafeBitCast(methodSignature, to: setValueForControlState.self) callback(self.currentComponent!.appearance(), Selector(modifiedSelector), valueOne!, valueTwo as! UInt) } } else if valueOne != nil { if isViewStackRelevant { if #available(iOS 9.0, *) { - _ = self.currentComponent?.appearance(whenContainedInInstancesOf: viewStack).perform(Selector(modifiedSelector), with: valueOne!) + _ = (self.currentComponent!.appearance(whenContainedInInstancesOf: viewStack) as! NSObject).perform(Selector(modifiedSelector), with: valueOne!) } else { - _ = self.currentComponent?.styleKitAppearanceWhenContained(within: viewStack).perform(Selector(modifiedSelector), with: valueOne!) + _ = self.currentComponent!.styleKitAppearanceWhenContained(within: viewStack).perform(Selector(modifiedSelector), with: valueOne!) } } else { - _ = self.currentComponent?.appearance().perform(Selector(modifiedSelector), with: valueOne!) + _ = (self.currentComponent!.appearance() as! NSObject).perform(Selector(modifiedSelector), with: valueOne!) } } } From 6eaa46e8422803b1f6f62f6bc9e4527d19ed544a Mon Sep 17 00:00:00 2001 From: Bernard Gatt Date: Wed, 29 Mar 2017 01:19:50 +0200 Subject: [PATCH 2/3] Updated TravisCI image version to XCode 8.3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b53a8a..26856b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: objective-c xcode_project: StyleKit.xcodeproj xcode_scheme: StyleKit -osx_image: xcode8 +osx_image: xcode8.3 xcode_sdk: macosx10.11 script: - - xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0' \ No newline at end of file + - xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0' From 80a3d416ca92d2b782ac599f89731b87941f0b6e Mon Sep 17 00:00:00 2001 From: Bernard Gatt Date: Fri, 31 Mar 2017 00:28:29 +0200 Subject: [PATCH 3/3] TravisCI tests will run on iOS 10.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26856b6..d64d8da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ osx_image: xcode8.3 xcode_sdk: macosx10.11 script: - - xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0' + - xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3'