Skip to content

Instantly share code, notes, and snippets.

@pselle

pselle/mapDict.swift

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.