DecodableStreamSerializer
public struct DecodableStreamSerializer<T> : DataStreamSerializer where T : Decodable
DataStreamSerializer which uses the provided DataPreprocessor and DataDecoder to serialize the incoming Data.
-
DataDecoderused to decode incomingData.Declaration
Swift
public let decoder: DataDecoder -
DataPreprocessorincomingDatais passed through before being passed to theDataDecoder.Declaration
Swift
public let dataPreprocessor: DataPreprocessor -
Creates an instance with the provided
DataDecoderandDataPreprocessor.Declaration
Swift
public init(decoder: DataDecoder = JSONDecoder(), dataPreprocessor: DataPreprocessor = PassthroughPreprocessor())Parameters
decoderDataDecoderused to decode incomingData.JSONDecoder()by default.dataPreprocessorDataPreprocessorused to process incomingDatabefore it’s passed through thedecoder.PassthroughPreprocessor()by default. -
Declaration
Swift
public func serialize(_ data: Data) throws -> T
View on GitHub
Install in Dash
DecodableStreamSerializer Structure Reference