QuerySerialization
public class QuerySerialization
Encodes and decodes query strings.
-
Creates a query string from a dictionary.
Note
The returned string does not contain the
?prefix.Declaration
Swift
public static func queryString(fromDictionary dictionary: [String: String], urlEncode: Bool = true) -> StringParameters
dictionaryThe dictionary to encode.
urlEncodeA Boolean indicating whether to add URL escapes to the query string. Default:
trueReturn Value
The dictionary encoded as a query string (
"foo=baz&a=b").
-
Decodes a query string.
Note
If the query string is not valid, an empty dictionary is returned.
Declaration
Swift
public static func decode(queryString: String, removePercentEncoding: Bool = true) -> [String: String]Parameters
queryStringThe query string to decode.
removePercentEncodingA Boolean indicating whether to remove URL encoding. Default:
trueReturn Value
The key-value pairs contained in the query string.
View on GitHub
Install in Dash
QuerySerialization Class Reference