RawRepresentable

extension RawRepresentable
  • Factory method that tries to create a new instance for a Type that is RawRepresentable and throws an UnsupportedRawValue when the Type‘s init?(rawValue:) returns nil.

    Throws

    whenever the Type does not support value as rawValue

    Declaration

    Swift

    static func decode(from value: Self.RawValue) throws -> Self

    Parameters

    value

    the raw value for the new instance

    Return Value

    a new instance with rawValue value