Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion for Swift 5 #85

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 27 additions & 3 deletions BoltsSwift.xcodeproj/project.pbxproj
Expand Up @@ -490,29 +490,39 @@
TargetAttributes = {
065894E61C9A933B000FDDA6 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 1020;
};
065894F31C9A93B7000FDDA6 = {
LastSwiftMigration = 1020;
};
0658950E1C9A947B000FDDA6 = {
LastSwiftMigration = 1020;
};
81CC14EB1A9BE0A100B28F86 = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 1020;
};
81CC14F51A9BE0A100B28F86 = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 1020;
};
87FEF3651A9085FA00C60678 = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
87FEF3701A9085FA00C60678 = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 87FEF3601A9085FA00C60678 /* Build configuration list for PBXProject "BoltsSwift" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 87FEF35C1A9085FA00C60678;
productRefGroup = 87FEF3671A9085FA00C60678 /* Products */;
Expand Down Expand Up @@ -701,69 +711,79 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52A1D3597BF00552C9F /* BoltsSwift-watchOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
065894ED1C9A933B000FDDA6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52A1D3597BF00552C9F /* BoltsSwift-watchOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
065894FD1C9A93B7000FDDA6 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5291D3597BF00552C9F /* BoltsSwift-tvOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
065894FE1C9A93B7000FDDA6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5291D3597BF00552C9F /* BoltsSwift-tvOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
065895191C9A947B000FDDA6 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52D1D3597BF00552C9F /* BoltsSwiftTests-tvOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
0658951A1C9A947B000FDDA6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52D1D3597BF00552C9F /* BoltsSwiftTests-tvOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
81CC15001A9BE0A100B28F86 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5281D3597BF00552C9F /* BoltsSwift-macOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
81CC15011A9BE0A100B28F86 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5281D3597BF00552C9F /* BoltsSwift-macOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
81CC15031A9BE0A100B28F86 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52C1D3597BF00552C9F /* BoltsSwiftTests-macOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
81CC15041A9BE0A100B28F86 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52C1D3597BF00552C9F /* BoltsSwiftTests-macOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -785,27 +805,31 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5271D3597BF00552C9F /* BoltsSwift-iOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
87FEF37E1A9085FA00C60678 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB5271D3597BF00552C9F /* BoltsSwift-iOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Release;
};
87FEF3801A9085FA00C60678 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52B1D3597BF00552C9F /* BoltsSwiftTests-iOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
};
name = Debug;
};
87FEF3811A9085FA00C60678 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 812DB52B1D3597BF00552C9F /* BoltsSwiftTests-iOS.xcconfig */;
buildSettings = {
SWIFT_VERSION = 5.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bpisano-luna this project uses xcconfigs to define the SWIFT_VERSION.
Please revert all "SWIFT_VERSION"-changes in this file and change the SWIFT_VERSION in all "Configurations/*xcconfig" files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your reply. I missed this part. I've changed all the version to Swift 5.0 in the configs and also incremented the version number to 1.5.0

};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Configurations/BoltsSwift-iOS.xcconfig
Expand Up @@ -16,6 +16,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.ios

IPHONEOS_DEPLOYMENT_TARGET = 8.0

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Sources/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwift-macOS.xcconfig
Expand Up @@ -16,6 +16,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.macos

MACOSX_DEPLOYMENT_TARGET = 10.10

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Sources/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwift-tvOS.xcconfig
Expand Up @@ -14,6 +14,6 @@
PRODUCT_NAME = BoltsSwift
PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.tvos

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Sources/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwift-watchOS.xcconfig
Expand Up @@ -14,6 +14,6 @@
PRODUCT_NAME = BoltsSwift
PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.watchos

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Sources/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwiftTests-iOS.xcconfig
Expand Up @@ -15,6 +15,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.ios.tests

IPHONEOS_DEPLOYMENT_TARGET = 8.0

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Tests/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwiftTests-macOS.xcconfig
Expand Up @@ -15,6 +15,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.macos.tests

MACOSX_DEPLOYMENT_TARGET = 10.10

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Tests/Info.plist
2 changes: 1 addition & 1 deletion Configurations/BoltsSwiftTests-tvOS.xcconfig
Expand Up @@ -13,6 +13,6 @@
PRODUCT_NAME = BoltsSwiftTests
PRODUCT_BUNDLE_IDENTIFIER = com.bolts.swift.tvos.tests

SWIFT_VERSION = 4.0
SWIFT_VERSION = 5.0

INFOPLIST_FILE = $(SRCROOT)/Tests/Info.plist
2 changes: 1 addition & 1 deletion Configurations/Version.xcconfig
Expand Up @@ -7,4 +7,4 @@
// of patent rights can be found in the PATENTS file in the same directory.
//

BOLTS_SWIFT_VERSION = 1.4.0
BOLTS_SWIFT_VERSION = 1.5.0
4 changes: 2 additions & 2 deletions Sources/BoltsSwift/Executor.swift
Expand Up @@ -128,9 +128,9 @@ extension Executor : CustomStringConvertible, CustomDebugStringConvertible {
case .operationQueue(let queue):
return "\(description): \(queue)"
case .closure(let closure):
return "\(description): \(closure)"
return "\(description): \(String(describing: closure))"
case .escapingClosure(let closure):
return "\(description): \(closure)"
return "\(description): \(String(describing: closure))"
default:
return description
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/BoltsSwift/Task.swift
Expand Up @@ -10,7 +10,7 @@
import Foundation

enum TaskState<TResult> {
case pending()
case pending
case success(TResult)
case error(Error)
case cancelled
Expand Down Expand Up @@ -53,7 +53,7 @@ public final class Task<TResult> {
fileprivate let synchronizationQueue = DispatchQueue(label: "com.bolts.task", attributes: DispatchQueue.Attributes.concurrent)
fileprivate var _completedCondition: NSCondition?

fileprivate var _state: TaskState<TResult> = .pending()
fileprivate var _state: TaskState<TResult> = .pending
fileprivate var _continuations: [Continuation] = Array()

// MARK: Initializers
Expand Down Expand Up @@ -108,7 +108,7 @@ public final class Task<TResult> {
The returned task will complete when the closure completes.
*/
public convenience init(_ executor: Executor = .default, closure: @escaping (() throws -> TResult)) {
self.init(state: .pending())
self.init(state: .pending)
executor.execute {
self.trySet(state: TaskState.fromClosure(closure))
}
Expand Down Expand Up @@ -242,7 +242,7 @@ public final class Task<TResult> {
var completedCondition: NSCondition?
synchronizationQueue.sync(flags: .barrier, execute: {
switch self._state {
case .pending():
case .pending:
stateChanged = true
self._state = state
continuations = self._continuations
Expand Down