PrimitivesEnumTranslator

public struct PrimitivesEnumTranslator : MetaSupplier, Unwrapper

A implementation of MetaSupplier and Unwrapper that gets Metas out of your way, so you will only have to work with Arrays, Dictionarys and the Primitive types you pass to it.

  • Create a new PrimitivesEnumTranslator.

    Note

    You have to pass Primitive.all, if you wan’t do be able to handle all of swifts standard types.

    Declaration

    Swift

    public init(primitives: Set<Primitive> = Primitive.all)

    Parameters

    primitives

    A set of primitives types you can handle directly. The default value is Primitive.all.

  • Declaration

    Swift

    public func wrap<T>(_ value: T, for encoder: MetaEncoder) throws -> Meta?
  • Declaration

    Swift

    public func unwrap<T>(meta: Meta, toType type: T.Type, for decoder: MetaDecoder) throws -> T?
  • This enum contains cases for all primitive types PrimitivesEnumTranslator can handle. The provided cases correspond to the types from the standard library, that have no mode of serializing themselves to another type (rely on a SingleValue(Encoding/Decoding)Container).

    See more

    Declaration

    Swift

    enum Primitive : Hashable