I’d like to map a function on all keys in the dictionary. I was hoping something like the following would work, but filter cannot be applied to dictionary directly. What’s the cleanest way of achieving this?
In this example, I’m trying to increment each value by 1. However this is incidental for the example – the main purpose is to figure out how to apply map() to a dictionary.
var d = ["foo" : 1, "bar" : 2]
d.map() {
$0.1 += 1
}