FieldDropdown

@objcMembers public final class FieldDropdown: Field

An input field for selecting options from a dropdown menu.

  • Defines an option for the dropdown, with a display name and underlying value.

    Declaration

    Swift

    public typealias Option = (displayName: String, value: String)
  • Drop-down options. First value is the display name, second value is the option value.

    Declaration

    Swift

    public var options: [Option]
  • The currently selected index

    Declaration

    Swift

    public var selectedIndex: Int
  • The option tuple of the currently selected index

    Declaration

    Swift

    public var selectedOption: Option?
  • Initializes the dropdown field.

    Declaration

    Swift

    public init(name: String, options: [(displayName: String, value: String)], selectedIndex: Int)
  • Initializes the dropdown field.

    Throws

    BlocklyError: Occurs if the size of the provided arrays do not match.

    Declaration

    Swift

    public convenience init(
        name: String, displayNames: [String], values: [String], selectedIndex: Int) throws