In my state machine, I have a state that has sub-states. Whenever the sub states's are done, I would like to go back to the initial state.
In order to achieve this I store the Previous State inside those sub-states:
enum AppState {
case StateA
case StateB
indirect case StateC-1(previousState: AppState)
indirect case StateC-2(previousState: AppState)
indirect case StateC-3(previousState: AppState)
}
This is pretty cumbersome and feels incorrect. Can anyone suggest a better design for this?
Thank you
Aucun commentaire:
Enregistrer un commentaire