From 89f3b12184dc27c03f1c0fc3606176ffe1fd1146 Mon Sep 17 00:00:00 2001 From: Tyler Cloutier Date: Thu, 16 Nov 2017 15:36:07 -0800 Subject: [PATCH] Updated for Swift 4. --- Package.resolved | 16 ++++++++++++++++ Package.swift | 19 ++++++++++++++++++- Sources/{ => AwaitKit}/AwaitKit.swift | 0 .../{ => AwaitKit}/AwaitKitExtension.swift | 0 .../{ => AwaitKit}/DispatchQueue+Async.swift | 0 .../{ => AwaitKit}/DispatchQueue+Await.swift | 0 Sources/{ => AwaitKit}/Info.plist | 0 .../AwaitKitAsyncTests.swift | 0 .../AwaitKitAwaitTests.swift | 2 +- Tests/{ => AwaitKitTests}/AwaitKitTests.swift | 12 ++++++------ Tests/{ => AwaitKitTests}/Info.plist | 0 11 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 Package.resolved rename Sources/{ => AwaitKit}/AwaitKit.swift (100%) rename Sources/{ => AwaitKit}/AwaitKitExtension.swift (100%) rename Sources/{ => AwaitKit}/DispatchQueue+Async.swift (100%) rename Sources/{ => AwaitKit}/DispatchQueue+Await.swift (100%) rename Sources/{ => AwaitKit}/Info.plist (100%) rename Tests/{ => AwaitKitTests}/AwaitKitAsyncTests.swift (100%) rename Tests/{ => AwaitKitTests}/AwaitKitAwaitTests.swift (99%) rename Tests/{ => AwaitKitTests}/AwaitKitTests.swift (90%) rename Tests/{ => AwaitKitTests}/Info.plist (100%) diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..d489029 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "PromiseKit", + "repositoryURL": "https://github.com/mxcl/PromiseKit.git", + "state": { + "branch": null, + "revision": "61f796319b16f0d4f3a8cd939d8e7f9a74963038", + "version": "4.3.2" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift index d074283..8c28a6e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,5 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. /* * AwaitKit * @@ -28,7 +30,22 @@ import PackageDescription let package = Package( name: "AwaitKit", + products: [ + .library( + name: "AwaitKit", + targets: ["AwaitKit"]), + ], dependencies: [ - .Package(url: "https://github.com/mxcl/PromiseKit.git", majorVersion: 4, minor: 3) + .package(url: "https://github.com/mxcl/PromiseKit.git", from: "4.3.0") + ], + targets: [ + .target( + name: "AwaitKit", + dependencies: [ + "PromiseKit", + ]), + .testTarget( + name: "AwaitKitTests", + dependencies: ["AwaitKit"]), ] ) diff --git a/Sources/AwaitKit.swift b/Sources/AwaitKit/AwaitKit.swift similarity index 100% rename from Sources/AwaitKit.swift rename to Sources/AwaitKit/AwaitKit.swift diff --git a/Sources/AwaitKitExtension.swift b/Sources/AwaitKit/AwaitKitExtension.swift similarity index 100% rename from Sources/AwaitKitExtension.swift rename to Sources/AwaitKit/AwaitKitExtension.swift diff --git a/Sources/DispatchQueue+Async.swift b/Sources/AwaitKit/DispatchQueue+Async.swift similarity index 100% rename from Sources/DispatchQueue+Async.swift rename to Sources/AwaitKit/DispatchQueue+Async.swift diff --git a/Sources/DispatchQueue+Await.swift b/Sources/AwaitKit/DispatchQueue+Await.swift similarity index 100% rename from Sources/DispatchQueue+Await.swift rename to Sources/AwaitKit/DispatchQueue+Await.swift diff --git a/Sources/Info.plist b/Sources/AwaitKit/Info.plist similarity index 100% rename from Sources/Info.plist rename to Sources/AwaitKit/Info.plist diff --git a/Tests/AwaitKitAsyncTests.swift b/Tests/AwaitKitTests/AwaitKitAsyncTests.swift similarity index 100% rename from Tests/AwaitKitAsyncTests.swift rename to Tests/AwaitKitTests/AwaitKitAsyncTests.swift diff --git a/Tests/AwaitKitAwaitTests.swift b/Tests/AwaitKitTests/AwaitKitAwaitTests.swift similarity index 99% rename from Tests/AwaitKitAwaitTests.swift rename to Tests/AwaitKitTests/AwaitKitAwaitTests.swift index 53ce892..5a93280 100644 --- a/Tests/AwaitKitAwaitTests.swift +++ b/Tests/AwaitKitTests/AwaitKitAwaitTests.swift @@ -60,7 +60,7 @@ class AwaitKitAwaitTests: XCTestCase { func testNoValueAwaitPromise() { let promise: Promise = Promise { resolve, reject in - resolve() + resolve(()) } XCTAssertNotNil(promise.value) diff --git a/Tests/AwaitKitTests.swift b/Tests/AwaitKitTests/AwaitKitTests.swift similarity index 90% rename from Tests/AwaitKitTests.swift rename to Tests/AwaitKitTests/AwaitKitTests.swift index f857acb..3fa2c06 100644 --- a/Tests/AwaitKitTests.swift +++ b/Tests/AwaitKitTests/AwaitKitTests.swift @@ -30,8 +30,8 @@ import XCTest class AwaitKitTests: XCTestCase { func testExcludeSameQueue() { - let promise = Promise { resolve, reject in - resolve() + let promise = Promise { resolve, reject in + resolve(()) } XCTAssertThrowsError(try DispatchQueue.main.ak.await(promise)) @@ -40,8 +40,8 @@ class AwaitKitTests: XCTestCase { func testAsyncAndAwaitOnDifferentQueue() { let expect = expectation(description: "Async should fulfill") - let promise = Promise { resolve, reject in - resolve() + let promise = Promise { resolve, reject in + resolve(()) } let result: Promise = async { @@ -58,8 +58,8 @@ class AwaitKitTests: XCTestCase { func testImbricationQueue() { let expect = expectation(description: "Async should fulfill") - let promise = Promise { resolve, reject in - resolve() + let promise = Promise { resolve, reject in + resolve(()) } let result: Promise = async { diff --git a/Tests/Info.plist b/Tests/AwaitKitTests/Info.plist similarity index 100% rename from Tests/Info.plist rename to Tests/AwaitKitTests/Info.plist