VariableValue

public enum VariableValue<Value>
extension VariableValue: Encodable where Value: Encodable
extension VariableValue: ExpressibleByBooleanLiteral where Value: ExpressibleByBooleanLiteral
extension VariableValue: ExpressibleByExtendedGraphemeClusterLiteral where Value: ExpressibleByExtendedGraphemeClusterLiteral
extension VariableValue: ExpressibleByFloatLiteral where Value: ExpressibleByFloatLiteral
extension VariableValue: ExpressibleByIntegerLiteral where Value: ExpressibleByIntegerLiteral
extension VariableValue: ExpressibleByNilLiteral where Value: ExpressibleByNilLiteral
extension VariableValue: ExpressibleByStringLiteral where Value: ExpressibleByStringLiteral
extension VariableValue: ExpressibleByUnicodeScalarLiteral where Value: ExpressibleByUnicodeScalarLiteral

An enum that represents either a Variable or a value of the generic type Value

  • This variable value represents a value.

    Declaration

    Swift

    case value(Value)
  • This variable value represents a variable.

    Declaration

    Swift

    case variable(Variable)
  • A convenience initializer for values.

    Declaration

    Swift

    public init(_ value: Value)

    Parameters

    value

    The Value value to store.

  • A convenience initializer for variables.

    Declaration

    Swift

    public init(_ variable: Variable)

    Parameters

    variable

    The Variable value to store.

Available where Value: Encodable

  • Encodes this value into the given encoder.

    Throws

    This function throws an error if any values are invalid for the given encoder’s format.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    The encoder to write data to.

Available where Value: ExpressibleByBooleanLiteral

  • Creates an instance initialized to the given Boolean value.

    Declaration

    Swift

    public init(booleanLiteral value: Value.BooleanLiteralType)

    Parameters

    value

    The value of the new instance.

Available where Value: ExpressibleByExtendedGraphemeClusterLiteral

  • Creates an instance initialized to the given value.

    Declaration

    Swift

    public init(extendedGraphemeClusterLiteral value: Value.ExtendedGraphemeClusterLiteralType)

    Parameters

    value

    The value of the new instance.

Available where Value: ExpressibleByFloatLiteral

  • Creates an instance initialized to the specified floating-point value.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using a floating-point literal.

    Declaration

    Swift

    public init(floatLiteral value: Value.FloatLiteralType)

    Parameters

    value

    The value of the new instance.

Available where Value: ExpressibleByIntegerLiteral

  • Creates an instance initialized to the specified integer value.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using an integer literal.

    Declaration

    Swift

    public init(integerLiteral value: Value.IntegerLiteralType)

    Parameters

    value

    The value of the new instance.

Available where Value: ExpressibleByNilLiteral

  • Creates an instance initialized with nil.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using a nil literal.

    Declaration

    Swift

    public init(nilLiteral: ())

    Parameters

    nilLiteral

    An empty tuple.

Available where Value: ExpressibleByStringLiteral

  • Creates an instance initialized to the given string value.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using a string literal.

    Declaration

    Swift

    public init(stringLiteral value: Value.StringLiteralType)

    Parameters

    value

    The value of the new instance.

Available where Value: ExpressibleByUnicodeScalarLiteral

  • Creates an instance initialized to the given value.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using a unicode scalar literal.

    Declaration

    Swift

    public init(unicodeScalarLiteral value: Value.UnicodeScalarLiteralType)

    Parameters

    value

    The value of the new instance.