DictionaryValue

public enum DictionaryValue
extension DictionaryValue: Encodable
extension DictionaryValue: ExpressibleByArrayLiteral
extension DictionaryValue: ExpressibleByBooleanLiteral
extension DictionaryValue: ExpressibleByDictionaryLiteral
extension DictionaryValue: ExpressibleByIntegerLiteral
extension DictionaryValue: ExpressibleByFloatLiteral
extension DictionaryValue: ExpressibleByStringLiteral
extension DictionaryValue: ExpressibleByStringInterpolation

A value that can be stored in a dictionary in the Shortcuts app.

  • A string value.

    Declaration

    Swift

    case string(Text)
  • A numeric value, stored as Text.

    Declaration

    Swift

    case number(Text)
  • A Boolean value or a variable representing one.

    Declaration

    Swift

    case boolean(VariableValue<Bool>)
  • A dictionary of other values.

    Declaration

    Swift

    case dictionary([(key: Text, value: DictionaryValue)])
  • An array of other dictionary values.

    Declaration

    Swift

    case array([DictionaryValue])

Convenience Constructors

  • This convenience constructor converts the Variable into a variable value.

    Declaration

    Swift

    public static func boolean(_ variable: Variable) -> DictionaryValue

    Parameters

    variable

    A variable.

    Return Value

    A Boolean dictionary value.

  • This convenience constructor converts the Bool into a variable value.

    Declaration

    Swift

    public static func boolean(_ value: Bool) -> DictionaryValue

    Parameters

    value

    A Boolean value.

    Return Value

    A Boolean dictionary value.

  • This convenience constructor converts the Number into a Text.

    Declaration

    Swift

    public static func number(_ value: Number) -> DictionaryValue

    Parameters

    value

    A numeric value.

    Return Value

    A dictionary value.

  • This convenience constructor converts the ordered KeyValuePairs collection into an Array of tuples.

    Declaration

    Swift

    public static func dictionary(_ value: KeyValuePairs<Text, DictionaryValue>) -> DictionaryValue

    Parameters

    value

    A dictionary literal.

    Return Value

    A dictionary value.

  • 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.

  • Creates an instance initialized with the given elements.

    Declaration

    Swift

    public init(arrayLiteral elements: DictionaryValue...)

    Parameters

    value

    The value of the new instance.

  • Creates an instance initialized to the given Boolean value.

    Attention

    Do not call this initializer directly. Instead, initialize a variable or constant using one of the Boolean literals true and false.

    Declaration

    Swift

    public init(booleanLiteral value: Bool)

    Parameters

    value

    The value of the new instance.

  • Creates an instance initialized with the given key-value pairs.

    Attention

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

    Declaration

    Swift

    public init(dictionaryLiteral elements: (Text, DictionaryValue)...)

    Parameters

    value

    The value of the new instance.

  • 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: Int)

    Parameters

    value

    The value of the new instance.

  • 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: Double)

    Parameters

    value

    The value of the new instance.

  • 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: String)

    Parameters

    value

    The value of the new instance.

  • Creates an instance from a string interpolation.

    Attention

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

    Declaration

    Swift

    public init(stringInterpolation: Text.StringInterpolation)

    Parameters

    stringInterpolation

    An instance of StringInterpolation which has had each segment of the string literal appended to it.