Ok. I got it working with some help from @hankg@mastodon.technology
This is my approach to refactor out #switch statements in #Swift:
- throw the name of the function and its case key into a dictionary.
- execute the function by key.
This example iterates over the dictionary.