Change

@objcMembers public final class Change: BlocklyEvent

Event fired when a property of a block changes.

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

    Declaration

    Swift

    public typealias Element = String
  • Element representing a block’s collapsed/expanded state.

    Declaration

    Swift

    public static let elementCollapsed: Element = "collapsed"
  • Element representing a block’s comment property.

    Declaration

    Swift

    public static let elementComment: Element = "comment"
  • Element representing a block’s disabled property.

    Declaration

    Swift

    public static let elementDisabled: Element = "disabled"
  • Element representing a block’s field.

    Declaration

    Swift

    public static let elementField: Element = "field"
  • Element representing a block’s inline property.

    Declaration

    Swift

    public static let elementInline: Element = "inline"
  • Element representing a block mutation.

    Declaration

    Swift

    public static let elementMutate: Element = "mutate"
  • The event type for BlocklyEvent.Change objects.

    Declaration

    Swift

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

    Declaration

    Swift

    public let element: Element
  • The field name affected by this change event.

    Declaration

    Swift

    public let fieldName: String?
  • The old value of the element.

    Declaration

    Swift

    public let oldValue: String?
  • The new value of the element.

    Declaration

    Swift

    public let newValue: String?
  • Convenience property for evaluating self.oldValue == "true"

    Declaration

    Swift

    public var oldBoolValue: Bool
  • Convenience property for evaluating self.newValue == "true"

    Declaration

    Swift

    public var newBoolValue: Bool
  • Constructs a BlocklyEvent.Change, signifying block’s value changed.

    Declaration

    Swift

    public init(
          element: Element, workspaceID: String, blockID: String, fieldName: String? = nil,
          oldValue: String? = nil, newValue: String? = nil)
  • Constructs a BlocklyEvent.Change from the JSON serialized representation.

    Throws

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

    Declaration

    Swift

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