I've been using compactMapValues() to transform values in a dictionary, resultin...

@puppethead@ieji.de

I've been using compactMapValues() to transform values in a dictionary, resulting in a new dictionary. But it turns out I need the key as well. After some searching I found the (cryptic) solution: Dictionary.reduce(into:).

This lets one build a new dictionary from an existing dictionary with full access to the source key/value pair.

Here's my reference:

medium.com/@mihirr_panchaal/sw

#SwiftLang