This is a rough implementation of the javascript XState library by davidkpiano
.
I was looking around for a finite state machine for Swift, and decided to port over the javascript library.
It's not as flexible as the javascript library, but does have that Swift type safety-ness.