Created
June 16, 2019 01:12
-
-
Save tjhv/bab9d974da48bad79f07c08f0cb5c190 to your computer and use it in GitHub Desktop.
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 Dictionary where Value: Equatable | |
{ | |
func allKeys(for value: Value) -> [Key] | |
{ | |
return self.enumerated().compactMap { | |
$0.element.value == value ? $0.element.key : nil | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment