I use the below to do this: dict2 = dict1.map { $0.withUpdate($0.0, value: $0.1) }
The above will effectively do a straight copy, you will probably want to modify the values passed in though… https://gist.github.com/dtartaglia/6141e6003e408399c2dd7a7cc266dce6#file-dictionaryextensions-swift extension Dictionary { /// An immutable version of update. Returns a new dictionary containing self's values and the key/value passed in. func withUpdate(key: Key, value: Value) -> Dictionary<Key, Value> { var result = self result[key] = value return result } } > On Aug 30, 2016, at 1:00 PM, swift-users-requ...@swift.org wrote: > > [swift-users] Mapping a Dictionary to a Dictionary?
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users