MultiDecoder

public class MultiDecoder<ResultType>

Simple pattern for trying to decode array elements as multiple types.

  • Adds the decoded result to results if decoding succeeds. If decoding fails because the shape type doesn’t match, do nothing. Throws all other errors.

    Another way to put it is that this method catches DrawsanaDecodingError.wrongShapeTypeError and Swift.DecodingError.valueNotFound.

    Declaration

    Swift

    public func decode<T>(_ type: T.Type) throws where T : Shape