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. AlwaysData.Declaration
Swift
public typealias Output = Data -
The
PropertyListEncoderused for encoding values.Declaration
Swift
public var encoder: PropertyListEncoder -
The
PropertyListDecoderused 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
encoderThe encoder used to encode values.
decoderThe 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
outputFormatThe 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
userInfoThe 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
outputFormatThe format of the property list to output.
userInfoThe 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 -> DataParameters
valueThe 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 -> InputParameters
dataThe property list data to untransform.
Return Value
The untransformed value.
View on GitHub
PropertyListTransformer Structure Reference