Event

public class Event : @unchecked Sendable

状态事件类

  • 事件名称,只读

    Declaration

    Swift

    public private(set) var name: String { get }
  • 来源状态列表,只读

    Declaration

    Swift

    public fileprivate(set) var sourceStates: [State] { get }
  • 目标状态,只读

    Declaration

    Swift

    public private(set) var targetState: State { get }
  • 能否触发block

    Declaration

    Swift

    public var shouldFireBlock: (@MainActor @Sendable (Transition) -> Bool)?
  • 即将触发block

    Declaration

    Swift

    public var willFireBlock: (@MainActor @Sendable (Transition) -> Void)?
  • 正在触发block,必须调用completion标记完成结果。YES事件完成、状态改变,NO事件失败、状态不变。不设置默认完成

    Declaration

    Swift

    public var fireBlock: (@MainActor @Sendable (Transition, @escaping @Sendable (Bool) -> Void) -> Void)?
  • 触发完成block,finished为完成状态

    Declaration

    Swift

    public var didFireBlock: (@MainActor @Sendable (Transition, Bool) -> Void)?
  • 初始化事件

    Declaration

    Swift

    public init(name: String, from states: [State], to state: State)