Skip to content

Commit

Permalink
Update README.md for 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Watters committed Oct 12, 2013
1 parent efb4329 commit 67205b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ TransitionKit

**A simple, elegantly designed block based API for implementing State Machines in Objective-C**

TransitionKit is a small Cocoa library that provides an API for implementing a state machine in Objective C. It is full-featured, completely documented, and very thoroughly unit tested. State machines are a great way to manage complexity in your application and TransitionKit provides you with a great way to take advantage of a state machine in your next iOS or Mac OS X application.
TransitionKit is a small Cocoa library that provides an API for implementing a state machine in Objective C. It is full-featured, completely documented, and very thoroughly unit tested. State machines are a great way to manage complexity in your application and TransitionKit provides you with an elegant API for implementing state machines in your next iOS or Mac OS X application.

### Features

* Supports an arbitrary number of States and Events.
* States and Events support a thorough set of block based callbacks for responding to state transitions.
* States, Events, and State Machines are NSCopying and NSCoding compliant, enabling easy integration with archiving and copying in your custom classes.
* Strongly enforced. The state machine includes numerous runtime checks for misconfigurations, making it easy to debug and trust your state machines.
* Transitions support the inclusion of arbitrary user data via a `userInfo` dictionary, making it easy to broadcast metadata across callbacks.
* Completely Documented. The entire library is marked up with Appledoc.
* Thorougly unit tested. You know it works and can make changes with confidence.
* Lightweight. TransitionKit has no dependencies beyond the Foundation library and works on iOS and Mac OS X.
Expand Down Expand Up @@ -63,15 +64,15 @@ The following example is a simple state machine that models the state of a Messa
TKStateMachine *inboxStateMachine = [TKStateMachine new];

TKState *unread = [TKState stateWithName:@"Unread"];
[unread setDidEnterStateBlock:^(TKState *state, TKStateMachine *stateMachine) {
[unread setDidEnterStateBlock:^(TKState *state, TKTransition *transition) {
[self incrementUnreadCount];
}];
TKState *read = [TKState stateWithName:@"Read"];
[read setDidExitStateBlock:^(TKState *state, TKStateMachine *stateMachine) {
[read setDidExitStateBlock:^(TKState *state, TKTransition *transition) {
[self decrementUnreadCount];
}];
TKState *deleted = [TKState stateWithName:@"Deleted"];
[deleted setDidEnterStateBlock:^(TKState *state, TKStateMachine *stateMachine) {
[deleted setDidEnterStateBlock:^(TKState *state, TKTransition *transition) {
[self moveMessageToTrash];
}];

Expand All @@ -98,7 +99,7 @@ success = [inboxStateMachine fireEvent:@"Mark as Unread" error:&error]; // YES
success = [inboxStateMachine canFireEvent:@"Mark as Unread"]; // NO

// Error. Cannot mark an Unread message as Unread
success = [inboxStateMachine fireEvent:@"Mark as Unread" error:&error]; // NO
success = [inboxStateMachine fireEvent:@"Mark as Unread" userInfo:nil error:&error]; // NO

// error is an TKInvalidTransitionError with a descriptive error message and failure reason
```
Expand Down

0 comments on commit 67205b5

Please sign in to comment.