Skip to content

Instantly share code, notes, and snippets.

@pselle
Last active August 29, 2015 14:16
Show Gist options
  • Save pselle/be4b40eb683045697307 to your computer and use it in GitHub Desktop.
Save pselle/be4b40eb683045697307 to your computer and use it in GitHub Desktop.
Dictionary Map Function in Swift
func mapDict<S, T, U>(myDict:[S:T], f: T -> U) -> [S:U] {
var newDict = [S: U]()
for (key, val) in myDict {
newDict[key] = f(val)
}
return newDict
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment