Skip to content

Instantly share code, notes, and snippets.

@richy486
Created June 20, 2018 19:51
Show Gist options
  • Save richy486/c4a2b44e5ffbe287ea16a5ee162d7a69 to your computer and use it in GitHub Desktop.
Save richy486/c4a2b44e5ffbe287ea16a5ee162d7a69 to your computer and use it in GitHub Desktop.
// Is this a good shorthand instead of using a switch?
enum State {
case running
case jumping
}
var currentState: State = .running
let stateView = currentState.transform {[
.running: RunningView(),
.jumping: JumpingView()
]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment