Update to Swift 5.0

This commit is contained in:
Quentin Jin 2019-03-18 21:07:08 +08:00
parent eba0eec371
commit 28df34d300
4 changed files with 36 additions and 17 deletions

View File

@ -109,7 +109,7 @@
OBJ_9 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; }; OBJ_9 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
"Schedule::Schedule::Product" /* Schedule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Schedule.framework; sourceTree = BUILT_PRODUCTS_DIR; }; "Schedule::Schedule::Product" /* Schedule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Schedule.framework; sourceTree = BUILT_PRODUCTS_DIR; };
"Schedule::ScheduleDemo::Product" /* ScheduleDemo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = ScheduleDemo; sourceTree = BUILT_PRODUCTS_DIR; }; "Schedule::ScheduleDemo::Product" /* ScheduleDemo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = ScheduleDemo; sourceTree = BUILT_PRODUCTS_DIR; };
"Schedule::ScheduleTests::Product" /* ScheduleTests.xctest */ = {isa = PBXFileReference; lastKnownFileType = file; path = ScheduleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; "Schedule::ScheduleTests::Product" /* ScheduleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = ScheduleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -318,12 +318,24 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 9999; LastUpgradeCheck = 9999;
TargetAttributes = {
"Schedule::Schedule" = {
LastSwiftMigration = 1020;
};
"Schedule::ScheduleDemo" = {
LastSwiftMigration = 1020;
};
"Schedule::ScheduleTests" = {
LastSwiftMigration = 1020;
};
};
}; };
buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "Schedule" */; buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "Schedule" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
English,
en, en,
); );
mainGroup = OBJ_5; mainGroup = OBJ_5;
@ -485,7 +497,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = Schedule; TARGET_NAME = Schedule;
TVOS_DEPLOYMENT_TARGET = 10.0; TVOS_DEPLOYMENT_TARGET = 10.0;
WATCHOS_DEPLOYMENT_TARGET = 3.0; WATCHOS_DEPLOYMENT_TARGET = 3.0;
@ -513,7 +525,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = Schedule; TARGET_NAME = Schedule;
TVOS_DEPLOYMENT_TARGET = 10.0; TVOS_DEPLOYMENT_TARGET = 10.0;
WATCHOS_DEPLOYMENT_TARGET = 3.0; WATCHOS_DEPLOYMENT_TARGET = 3.0;
@ -537,7 +549,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
SWIFT_FORCE_STATIC_LINK_STDLIB = NO; SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = ScheduleDemo; TARGET_NAME = ScheduleDemo;
}; };
name = Debug; name = Debug;
@ -559,7 +571,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
SWIFT_FORCE_STATIC_LINK_STDLIB = NO; SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = ScheduleDemo; TARGET_NAME = ScheduleDemo;
}; };
name = Release; name = Release;
@ -605,13 +617,17 @@
); );
HEADER_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Schedule.xcodeproj/ScheduleTests_Info.plist; INFOPLIST_FILE = Schedule.xcodeproj/ScheduleTests_Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_CFLAGS = "$(inherited)"; OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = ScheduleTests; TARGET_NAME = ScheduleTests;
TVOS_DEPLOYMENT_TARGET = 10.0;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
}; };
name = Debug; name = Debug;
}; };
@ -626,13 +642,17 @@
); );
HEADER_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Schedule.xcodeproj/ScheduleTests_Info.plist; INFOPLIST_FILE = Schedule.xcodeproj/ScheduleTests_Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_CFLAGS = "$(inherited)"; OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGET_NAME = ScheduleTests; TARGET_NAME = ScheduleTests;
TVOS_DEPLOYMENT_TARGET = 10.0;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
}; };
name = Release; name = Release;
}; };

View File

@ -48,11 +48,6 @@ extension Interval {
extension Interval: Hashable { extension Interval: Hashable {
/// The hashValue of this interval.
public var hashValue: Int {
return nanoseconds.hashValue
}
/// Returns a boolean value indicating whether two intervals are equal. /// Returns a boolean value indicating whether two intervals are equal.
public static func == (lhs: Interval, rhs: Interval) -> Bool { public static func == (lhs: Interval, rhs: Interval) -> Bool {
return lhs.nanoseconds == rhs.nanoseconds return lhs.nanoseconds == rhs.nanoseconds

View File

@ -306,9 +306,9 @@ open class Task {
extension Task: Hashable { extension Task: Hashable {
/// The task's hash value.
public var hashValue: Int { public func hash(into hasher: inout Hasher) {
return ObjectIdentifier(self).hashValue hasher.combine(ObjectIdentifier(self))
} }
/// Returns a boolean value indicating whether two tasks are equal. /// Returns a boolean value indicating whether two tasks are equal.

View File

@ -9,11 +9,15 @@ extension TaskCenter {
weak var task: Task? weak var task: Task?
// To find slot // To find slot
let hashValue: Int let hash: Int
init(_ task: Task) { init(_ task: Task) {
self.task = task self.task = task
self.hashValue = task.hashValue self.hash = task.hashValue
}
func hash(into hasher: inout Hasher) {
hasher.combine(hash)
} }
// To find task // To find task