FWStateEvent


@interface FWStateEvent : NSObject

状态事件类

  • 事件名称,只读

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull name;
  • 来源状态列表,只读

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<FWStateObject *> *_Nonnull sourceStates;
  • 目标状态,只读

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) FWStateObject *_Nonnull targetState;
  • 能否触发block

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) BOOL (^) (FWStateTransition *_Nonnull __strong) shouldFireBlock;
  • 即将触发block

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (FWStateTransition *_Nonnull __strong) willFireBlock;
  • 正在触发block,必须调用completion标记完成结果。YES事件完成、状态改变,NO事件失败、状态不变。不设置默认完成

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (FWStateTransition *_Nonnull __strong, void (^_Nonnull __strong)(BOOL)) fireBlock;
  • 触发完成block,finished为完成状态

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (FWStateTransition *_Nonnull __strong, BOOL) didFireBlock;
  • 初始化事件

    Declaration

    Objective-C

    + (nonnull instancetype)eventWithName:(nonnull NSString *)name
                               fromStates:
                                   (nonnull NSArray<FWStateObject *> *)sourceStates
                                  toState:(nonnull FWStateObject *)targetState;