iOS/Sources/App/Utilities/Extensions/NSURL+QueryDictionary.swift

14 lines
371 B
Swift

import Foundation
extension URL {
var queryItems: [String: String]? {
var params = [String: String]()
return URLComponents(url: self, resolvingAgainstBaseURL: false)?
.queryItems?
.reduce([:], { _, item -> [String: String] in
params[item.name] = item.value
return params
})
}
}