Przeglądaj źródła

Added Swift 4.2 support.

Spencer Whyte 6 lat temu
rodzic
commit
d4107aa8cf

+ 1 - 1
.travis.yml

@@ -1,5 +1,5 @@
 language: objective-c
-osx_image: xcode9.2
+osx_image: xcode10
 
 before_install:
   - gem install xcpretty

+ 2 - 2
SwiftyStoreKit-iOS-Demo/AppDelegate.swift

@@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
 
         setupIAP()
 
@@ -61,7 +61,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         SwiftyStoreKit.updatedDownloadsHandler = { downloads in
 
             // contentURL is not nil if downloadState == .finished
-            let contentURLs = downloads.flatMap { $0.contentURL }
+            let contentURLs = downloads.compactMap { $0.contentURL }
             if contentURLs.count == downloads.count {
                 print("Saving: \(contentURLs)")
                 SwiftyStoreKit.finishTransaction(downloads[0].transaction)

+ 4 - 4
SwiftyStoreKit-macOS-Demo/ViewController.swift

@@ -160,13 +160,13 @@ extension ViewController {
         let alert: NSAlert = NSAlert()
         alert.messageText = title
         alert.informativeText = message
-        alert.alertStyle = NSAlertStyle.informational
+        alert.alertStyle = .informational
         return alert
     }
-    func showAlert(_ alert: NSAlert, handler: ((NSModalResponse) -> Void)? = nil) {
+    func showAlert(_ alert: NSAlert, handler: ((NSApplication.ModalResponse) -> Void)? = nil) {
 
-        if let window = NSApplication.shared().keyWindow {
-            alert.beginSheetModal(for: window) { (response: NSModalResponse) in
+        if let window = NSApplication.shared.keyWindow {
+            alert.beginSheetModal(for: window) { (response: NSApplication.ModalResponse) in
                 handler?(response)
             }
         } else {

+ 4 - 4
SwiftyStoreKit.xcodeproj/project.pbxproj

@@ -986,7 +986,7 @@
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
-				SWIFT_VERSION = 3.0;
+				SWIFT_VERSION = 4.2;
 			};
 			name = Debug;
 		};
@@ -1032,7 +1032,7 @@
 				MACOSX_DEPLOYMENT_TARGET = 10.10;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
-				SWIFT_VERSION = 3.0;
+				SWIFT_VERSION = 4.2;
 				VALIDATE_PRODUCT = YES;
 			};
 			name = Release;
@@ -1135,7 +1135,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
-				SWIFT_VERSION = 3.0;
+				SWIFT_VERSION = 4.2;
 				TARGETED_DEVICE_FAMILY = 3;
 				TVOS_DEPLOYMENT_TARGET = 10.1;
 			};
@@ -1157,7 +1157,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
-				SWIFT_VERSION = 3.0;
+				SWIFT_VERSION = 4.2;
 				TARGETED_DEVICE_FAMILY = 3;
 				TVOS_DEPLOYMENT_TARGET = 10.1;
 			};

+ 1 - 1
scripts/build.sh

@@ -23,4 +23,4 @@ echo ""
 echo "${bold}/****************************/"
 echo "/* Run: SwiftyStoreKitTests */"
 echo "/****************************/${normal}"
-set -o pipefail && xcodebuild test -project SwiftyStoreKit.xcodeproj -scheme SwiftyStoreKitTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | tee xcodebuild.log | xcpretty
+set -o pipefail && xcodebuild test -project SwiftyStoreKit.xcodeproj -scheme SwiftyStoreKitTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=12.0' | tee xcodebuild.log | xcpretty