PropertyListTransformer

public struct PropertyListTransformer<Input> : Transformer where Input : Decodable, Input : Encodable

A transformer that transformers values to property list data.

  • The output of the PropertyListTransformer. Always Data.

    Declaration

    Swift

    public typealias Output = Data
  • The PropertyListEncoder used for encoding values.

    Declaration

    Swift

    public var encoder: PropertyListEncoder
  • The PropertyListDecoder used for decoding values.

    Declaration

    Swift

    public var decoder: PropertyListDecoder
  • Create a new instance of PropertyListTransformer.

    Declaration

    Swift

    public init(encoder: PropertyListEncoder = PropertyListEncoder(), decoder: PropertyListDecoder = PropertyListDecoder())

    Parameters

    encoder

    The encoder used to encode values.

    decoder

    The decoder used to decode values.

  • Create a new instance of PropertyListTransformer, configuring the encoder to output the property list using the provided format.

    Declaration

    Swift

    public init(outputFormat: PropertyListSerialization.PropertyListFormat)

    Parameters

    outputFormat

    The format of the property list to output.

  • Create a new instance of PropertyListTransformer, configuring the encoder and decoder with the provided user info dictionary.

    Declaration

    Swift

    public init(coderUserInfo userInfo: [CodingUserInfoKey : Any])

    Parameters

    userInfo

    The user info dictionary to apply to the encoder and decoder.

  • Create a new instance of PropertyListTransformer, configuring the encoder and decoder with the provided user info dictionary and configuring the encoder to output the property list using the provided format.

    Declaration

    Swift

    public init(outputFormat: PropertyListSerialization.PropertyListFormat, coderUserInfo userInfo: [CodingUserInfoKey : Any])

    Parameters

    outputFormat

    The format of the property list to output.

    userInfo

    The user info dictionary to apply to the encoder and decoder.

  • Transformer the provided value to property list data.

    Throws

    Any error thrown by the encoder.

    Declaration

    Swift

    public func transformValue(_ value: Input) throws -> Data

    Parameters

    value

    The value to transform to property list data.

    Return Value

    The property list data.

  • Untransformer the provided property list data.

    Throws

    Any error thrown by the decoder.

    Declaration

    Swift

    public func untransformValue(_ data: Data) throws -> Input

    Parameters

    data

    The property list data to untransform.

    Return Value

    The untransformed value.