Skip to content

Instantly share code, notes, and snippets.

@FabP93
Created April 19, 2020 17:06
Show Gist options
  • Save FabP93/cca718137eaa5a43d75cbdba476e7752 to your computer and use it in GitHub Desktop.
Save FabP93/cca718137eaa5a43d75cbdba476e7752 to your computer and use it in GitHub Desktop.
Hash example
extension Key: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(self.id)
}
func hash(into hasher: inout Hasher) {
hasher.combine(self.id)
}
}
print(dict.count) // 1
print(key1 == key2) // true
print(key1.hashValue == key2.hashValue) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment