I suggest using State Machine Compiler, it will output Objective-C code. I have had good success in Java and Python using this.
You shouldn’t be writing state machine code by hand, you should be using something to generate the code for you. SMC will generate clean clear code you can then look at if you want to learn from it, or you can just use it and be done with it.