Skip to content

Instantly share code, notes, and snippets.

@FabP93
Created April 19, 2020 17:04
Show Gist options
  • Save FabP93/0efcc98c73c7d571239918a31e9e0b7d to your computer and use it in GitHub Desktop.
Save FabP93/0efcc98c73c7d571239918a31e9e0b7d to your computer and use it in GitHub Desktop.
Hash example
let key1 = Key(id: 1, title: "Key1")
let key2 = Key(id: 1, title: "Key2")
dict[key1] = 1058
dict[key2] = 368
print(dict.count) // 2
print(key1 == key2) // false
print(key1.hashValue == key2.hashValue) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment