Created
April 19, 2020 17:06
-
-
Save FabP93/cca718137eaa5a43d75cbdba476e7752 to your computer and use it in GitHub Desktop.
Hash example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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