Skip to content

Commit

Permalink
Updated to Swift 4.2 package manager
Browse files Browse the repository at this point in the history
Also updated Interval : Hashable to latest conformance, which uses `Hasher` to combine hash values.  This means that we can no longer expect a certain value from interval.hashValue and thus the test "has a hashValue" needed to modified slightly.

Updated the CocoaPods version to 1.0.1 due to the slight change to Interval's Hashable conformance.
  • Loading branch information
foscomputerservices committed Mar 26, 2019
1 parent d960ecd commit 57b3cf6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1
4.2
15 changes: 14 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Time"
name: "Time",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library( name: "Time", targets: ["Time"] )
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target( name: "Time" ),
.testTarget( name: "TimeTests", dependencies: ["Time"] )
]
)
File renamed without changes.
5 changes: 2 additions & 3 deletions Sources/Time.swift → Sources/Time/Time.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ extension Interval : Hashable {
return lhs != rhs.converted()
}

public var hashValue: Int {
return timeInterval.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(timeInterval.hashValue)
}

}

extension Interval {
Expand Down
2 changes: 1 addition & 1 deletion Tests/TimeTests/Spectre/Expectation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct ExpectationFailure : FailureType {

open class Expectation<T> : ExpectationType {
public typealias ValueType = T
open let expression: () throws -> ValueType?
public let expression: () throws -> ValueType?

let file: String
let line: Int
Expand Down
2 changes: 1 addition & 1 deletion Tests/TimeTests/TimeSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func testTime() {
}
$0.it("has a hashValue") {
let interval = Interval<OneSecond>(10)
try expect(interval.hashValue) == interval.timeInterval.hashValue
try expect(interval.hashValue) != 0
}
}

Expand Down
2 changes: 1 addition & 1 deletion TimeIntervals.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "TimeIntervals"
s.version = "1.0.0"
s.version = "1.0.1"
s.summary = "Type-safe time calculations for Swift."
s.description = <<-DESC
Type-safe time calculations for Swift, powered by generics.
Expand Down

0 comments on commit 57b3cf6

Please sign in to comment.