Under the Bridge


So you have some complicated state management in your app? Some really complicated state management? Well, this might be just the thing for you:


AQAppStateMachine is designed to assist the development of applications with some fairly intricate state requirements. The idea is that the state itself is stored as an n-bit bitfield, and that the application can define certain ranges of this bitfield to refer to state flags. These flags can be combinatory or mutually exclusive, or hell, they could just be integers. The state machine itself is designed for an app which needs to, say, do Task A, but only if B has been initialized, C has failed to initialize, and D is not currently happening, along with E, F, and G each being in one or more of a number of states…

Yikes. Offhand we can’t think of any state machine we ever did with more than three conditions for a transition … but if the need ever arises, now we certainly know where to look! Block-based so iOS 4+ only, but hey that’s getting to be less of an issue all the time.