Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 510f3da

Browse files
committed
updated depricated hashable values to hash into methods
1 parent c22182f commit 510f3da

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

‎Graph/Graph/Edge.swift‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ extension Edge: CustomStringConvertible {
2929

3030
extension Edge: Hashable {
3131

32-
public var hashValue: Int {
33-
var string = "\(from.description)\(to.description)"
34-
if weight != nil {
35-
string.append("\(weight!)")
36-
}
37-
return string.hashValue
32+
public func hash(into hasher: inout Hasher) {
33+
hasher.combine(from.description)
34+
hasher.combine(to.description)
35+
hasher.combine(weight)
3836
}
3937
}
4038

‎Graph/Graph/Vertex.swift‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ extension Vertex: CustomStringConvertible {
2424

2525
extension Vertex: Hashable {
2626

27-
public var hashValue: Int {
28-
return "\(data)\(index)".hashValue
27+
public func hash(into hasher: inout Hasher) {
28+
hasher.combine(data)
29+
hasher.combine(index)
2930
}
3031

3132
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /