StatefulDecoder

public protocol StatefulDecoder : StatefulCoder

An object that reconstitutes values from a serialized Encoding, maintaining state across the deserialization of individual parts.

Note

this protocol matches Foundation’s XXXEncoder types, which—confusingly—do not themselves conform to the Encoder protocol.
  • Returns the T value that was serialized into archive.

    Declaration

    Swift

    func decode<T>(_ type: T.Type, from archive: Encoding) throws -> T where T : Decodable
  • decode(_:from:startState:) Extension method

    Returns the T value that was serialized into archive, using startState as the initial decoding state.

    Declaration

    Swift

    public mutating func decode<T, State: Sendable>(_ type: T.Type, from encodedT: Encoding, startState: State)
      throws -> T where T: Decodable