| 测试已测试 | ✗ |
| 语言语言 | Obj-CObjective C |
| 许可证 | BSD 3.0 |
| 发布最后发布 | 2015 年 3 月 |
由 Alberto De Bortoli 维护。
Objective-C 的正确线程安全状态机。
简单用法
pod "ADBStateMachine" 添加到 Podfile 中来安装ADBStateMachine.hself.stateMachine = [[ADBStateMachine alloc] initWithInitialState:@"Idle" callbackQueue:nil];ADBStateMachineTransition *t1 = [[ADBStateMachineTransition alloc] initWithEvent:@"start"
fromState:@"Idle"
toState:@"Started"
preBlock:^{
NSLog(@"Gonna move from Idle to Started!");
}
postBlock:^{
NSLog(@"Just moved from Idle to Started!");
}];
ADBStateMachineTransition *t2 = [[ADBStateMachineTransition alloc] initWithEvent:@"pause"
fromState:@"Started"
toState:@"Idle"
preBlock:nil
postBlock:nil];
[stateMachine addTransition:t1];
[stateMachine addTransition:t2];[stateMachine processEvent:@"start"];
[stateMachine processEvent:@"pause"];