Skip to content

Instantly share code, notes, and snippets.

@victoraugustolls
Created June 3, 2016 15:10
Show Gist options
  • Save victoraugustolls/0a6979ab72a19af84679571dfdf93208 to your computer and use it in GitHub Desktop.
Save victoraugustolls/0a6979ab72a19af84679571dfdf93208 to your computer and use it in GitHub Desktop.
Swift dictionary type extension.
extension Dictionary where Value : Equatable {
func allKeysForValue(val : Value) -> [Key] {
return self.filter { $1 == val }.map { $0.0 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment