DictionarySlicing is a Swift Package Manager package for iOS/tvOS (10.0 and above), watchOS (4.0 and above), and macOS (10.14 and above), under Swift 5.0 and above, implementing an extension to Dictionary
to convert a dictionary into its slice or into an array of its key-value pairs:
public extension Dictionary {
func toSlice() -> Dictionary.SubSequence
func toKeyValuePairs() -> [Element]
}
public func toDictionary<K: Hashable, V>(_ subseq: Dictionary<K, V>.SubSequence) -> [K: V]
public func toDictionary<K: Hashable, V>(_ kvPairs: [Dictionary<K, V>.Element]) -> [K: V]
DictionarySlicing is provided only as a Swift Package Manager package, because I'm moving away from CocoaPods and Carthage, and can be easily installed directly from Xcode.
DictionarySlicing is available under the MIT license. See the LICENSE file for more info.