State machine framework for Objective-C