Instance Method


Returns a Boolean value indicating whether a state machine currently in this state is allowed to transition into the specified state.


- (BOOL)isValidNextState:(Class)stateClass;



A custom GKState class used in the same state machine as this state.

Return Value

YES if a transition into the specified state should be allowed; otherwise, NO.


When you call the canEnterState: or enterState: method of a GKStateMachine object currentState property is this state, the state machine calls this method to determine whether a transition to the proposed next state is allowed. Override this method in each custom state class you implement to choose which other states should be valid transitions from this state.

By restricting the set of valid state transitions, you can use a state machine to enforce invariant conditions in your code. For example, if one state class can be entered only after a state machine has passed through a series of other states, code in that state class can safely assume that any actions performed by those other states have already occurred.

See Also

Working with State Machines


The state machine that owns this state object.