Skip to content

Instantly share code, notes, and snippets.

@juliengdt
Created May 10, 2019 09:13
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 juliengdt/a4e041b9ddb376721587271dd171787a to your computer and use it in GitHub Desktop.
Save juliengdt/a4e041b9ddb376721587271dd171787a to your computer and use it in GitHub Desktop.
enum Restaurant: RawRepresentable {
typealias RawValue = Array<Int>
case toto
case tata
var rawValue: Array<Int> {
switch self {
case .tata:
return [0,1,2]
case .toto:
return [3,4,5]
}
}
init?(rawValue: Array<Int>) {
switch rawValue {
case [0,1,2]:
self = .toto
default:
self = .tata
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment