A StateMachine dev by swift