Skip to content

Commit

Permalink
Merge pull request #15 from jnewc/master
Browse files Browse the repository at this point in the history
Use compactMap where available
  • Loading branch information
samdeane authored Nov 6, 2018
2 parents db3803b + baf583a commit e4371b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/DictionaryCoding/DictionaryDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ fileprivate struct DictionaryCodingKeyedDecodingContainer<K : CodingKey> : Keyed

// MARK: - KeyedDecodingContainerProtocol Methods
public var allKeys: [Key] {
#if swift(>=4.1)
return self.container.keys.compactMap { Key(stringValue: $0) }
#else
return self.container.keys.flatMap { Key(stringValue: $0) }
#endif
}

public func contains(_ key: Key) -> Bool {
Expand Down

0 comments on commit e4371b7

Please sign in to comment.