ParameterEncoder
public protocol ParameterEncoder : Sendable
A type that can encode any Encodable type into a URLRequest.
-
Encode the provided
Encodableparameters intorequest.Throws
An
Errorwhen encoding fails. For Alamofire provided encoders, this will be an instance ofAFError.parameterEncoderFailedwith an associatedParameterEncoderFailureReason.Declaration
Swift
func encode<Parameters>(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest where Parameters : Encodable, Parameters : SendableParameters
parametersThe
Encodableparameter value.requestThe
URLRequestinto which to encode the parameters.Return Value
A
URLRequestwith the result of the encoding.
-
jsonExtension methodProvides a default
JSONParameterEncoderinstance.Declaration
Swift
public static var json: JSONParameterEncoder { get } -
json(encoder:Extension method) Creates a
JSONParameterEncoderusing the providedJSONEncoder.Declaration
Swift
public static func json(encoder: JSONEncoder = JSONEncoder()) -> JSONParameterEncoderParameters
encoderJSONEncoderused to encode parameters.JSONEncoder()by default.Return Value
The
JSONParameterEncoder.
-
urlEncodedFormExtension methodProvides a default
URLEncodedFormParameterEncoderinstance.Declaration
Swift
public static var urlEncodedForm: URLEncodedFormParameterEncoder { get } -
urlEncodedForm(encoder:Extension methoddestination: ) Creates a
URLEncodedFormParameterEncoderwith the provided encoder and destination.Declaration
Swift
public static func urlEncodedForm(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(), destination: URLEncodedFormParameterEncoder.Destination = .methodDependent) -> URLEncodedFormParameterEncoderParameters
encoderURLEncodedFormEncoderused to encode the parameters.URLEncodedFormEncoder()by default.destinationDestinationto which to encode the parameters..methodDependentby default.Return Value
View on GitHub
Install in Dash