Skip to content

Instantly share code, notes, and snippets.

@Maxatma
Created January 9, 2019 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maxatma/6618d92b845fc6ec6da909e081d9b357 to your computer and use it in GitHub Desktop.
Save Maxatma/6618d92b845fc6ec6da909e081d9b357 to your computer and use it in GitHub Desktop.
Swift switch enum problem
import UIKit
enum DumbTest {
case get(user: String)
case get(pony: String, tail: String)
func getSome() -> String {
switch self {
case .get(let user):
return "User muchacha \(user)"
case .get(let pony, let tail):
return "Fluttershy \(pony) with \(tail) tail"
}
}
}
DumbTest.get(pony: "cute pony", tail: "pink").getSome()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment