This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Dictionary { | |
/// Transforms dictionary keys without modifying values. | |
/// Deduplicates transformed keys. | |
/// | |
/// Example: | |
/// ``` | |
/// ["one": 1, "two": 2, "three": 3, "": 4].mapKeys({ $0.first }, uniquingKeysWith: { max($0, $1) }) | |
/// // [Optional("o"): 1, Optional("t"): 3, nil: 4] | |
/// ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Erica Sadun, http://ericasadun.com | |
Cross Platform Defines | |
Apple Platforms Only | |
Will update to #if canImport() when available | |
*/ |