UI

@objcMembers public final class UI: BlocklyEvent

Event class for user interface related actions, including selecting blocks, opening/closing the toolbox or trash, and changing toolbox categories.

  • Value type used for indicating which element is being associated with the UI event.

    Declaration

    Swift

    public typealias Element = String
  • Element representing the visibility of a toolbox category.

    Declaration

    Swift

    public static let elementCategory: Element = "category"
  • Element representing if a block was tapped on.

    Declaration

    Swift

    public static let elementClick: Element = "click"
  • Element representing the visibility of a block comment.

    Declaration

    Swift

    public static let elementCommentOpen: Element = "commentOpen"
  • Element representing the visibility of a block mutator popover.

    Declaration

    Swift

    public static let elementMutatorOpen: Element = "mutatorOpen"
  • Element representing the selection state of a block.

    Declaration

    Swift

    public static let elementSelected: Element = "selected"
  • Element representing the visibility of the trash can folder.

    Declaration

    Swift

    public static let elementTrashOpen: Element = "trashOpen"
  • Element representing the visibility of a block’s warning message.

    Declaration

    Swift

    public static let elementWarningOpen: Element = "warningOpen"
  • The event type for BlocklyEvent.UI objects.

    Declaration

    Swift

    public static let EVENT_TYPE = "ui"
  • The element associated with the UI event.

    Declaration

    Swift

    public let element: Element
  • The old value of the element.

    Declaration

    Swift

    public private(set) var oldValue: String?
  • The new value of the element.

    Declaration

    Swift

    public private(set) var newValue: String?
  • Constructs a block related UI event, such as clicked, selected, comment opened, mutator opened, or warning opened.

    Declaration

    Swift

    public init(
          element: Element, workspace: Workspace, block: Block?, oldValue: String? = nil,
          newValue: String? = nil)
  • Constructs a BlocklyEvent.UI from the JSON serialized representation.

    Throws

    BlocklyError: Thrown when the JSON could not be parsed into a BlocklyEvent.UI object.

    Declaration

    Swift

    public init(json: [String: Any]) throws
  • Declaration

    Swift

    public override func toJSON() throws -> [String: Any]