URLDecoder
public final class URLDecoder : URLDecoderProtocol
A class for universally decoding Codable objects from a URL’s query parameters.
-
Initializes a new instance of
URLDecoder.Declaration
Swift
public init() -
Decodes a
Codableobject from the given URL’s query parameters.Throws
Throws an error if decoding fails.Declaration
Swift
public func decode<T: URLCodable>( type: T.Type, from url: URL, decoder: JSONDecoder ) throws -> TParameters
typeThe type conforming to
URLCodableto decode.urlThe URL containing the query parameters.
decoderThe
JSONDecoderused for decoding (defaults toJSONDecoder).Return Value
A decoded instance of the specified type.