Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Classes/Protocols/Identable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ public protocol Identable: Hashable, AnyIdentable {
}

extension Identable {
func hash(into hasher: inout Hasher) {
public func hash(into hasher: inout Hasher) {
hasher.combine(self[keyPath: Self.idKey])
}

public func identHash() -> Int {
self[keyPath: Self.idKey].hashValue
}

public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.identHash() == rhs.identHash()
}
}