MultipartFormDataEncoder
public class MultipartFormDataEncoder
An object that encodes Encodable
objects into MultipartFormData
.
-
Defines available strategies to use when encoding key names.
See moreDeclaration
Swift
public enum KeyEncodingStrategy
-
Defines available strategies when encoding
See moreDate
instances.Declaration
Swift
public enum DateEncodingStrategy
-
Defines available strategies when encoding
See moreData
instances.Declaration
Swift
public enum DataEncodingStrategy
-
The strategy to use for encoding key names. Defaults to
KeyEncodingStrategy.useDefaultKeys
.Declaration
Swift
public var keyEncodingStrategy: KeyEncodingStrategy { get set }
-
The strategy to use for encoding
Date
instances. Defaults toDateEncodingStrategy.deferredToDate
.Declaration
Swift
public var dateEncodingStrategy: DateEncodingStrategy { get set }
-
The strategy to use for encoding
Data
instances. Defaults toDataEncodingStrategy.raw
.Declaration
Swift
public var dataEncodingStrategy: DataEncodingStrategy { get set }
-
Creates a new
MultipartFormDataEncoder
.Declaration
Swift
public init()
-
Encodes an
Encodable
into aMultipartFormData
.Throws
EncodingError.invalidValue(_:,_:)
if the object can’t be encoded for some reason.Declaration
Swift
public func encode<T>(_ value: T) throws -> MultipartFormData where T : Encodable
Parameters
value
The object to encode.
Return Value
A
MultipartFormData
that representsvalue
.