mapValues(_:)
Returns a new dictionary containing the keys of this dictionary with the values transformed by the given closure.
Declaration
func mapValues<T>(_ transform: (Value) throws -> T) rethrows -> Dictionary<Key, T>Parameters
- transform:
A closure that transforms a value.
transformaccepts each value of the dictionary as its parameter and returns a transformed value of the same or of a different type.
Return Value
A dictionary containing the keys and transformed values of this dictionary.