Skip to content

Instantly share code, notes, and snippets.

@ha1f
Created October 11, 2017 04:46
Show Gist options
  • Select an option

  • Save ha1f/9987f602cd9fb3345ef24cb4ab1ab9a3 to your computer and use it in GitHub Desktop.

Select an option

Save ha1f/9987f602cd9fb3345ef24cb4ab1ab9a3 to your computer and use it in GitHub Desktop.
extension Dictionary {
func duplicated() -> Dictionary<Key, Value> {
return reduce(into: [Key: Value]()) { (dict, item) in
dict[item.key] = item.value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment