StateEvent

public class StateEvent : @unchecked Sendable

状态事件类

  • 事件名称,只读

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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