Returns a Boolean value indicating whether a state machine currently in this state is allowed to transition into the specified state.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
GKStateclass used in the same state machine as this state.
YES if a transition into the specified state should be allowed; otherwise,
When you call the
enter method of a
current 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.