Skip to content

Instantly share code, notes, and snippets.

@vialyx
Last active August 11, 2018 18:54
Show Gist options
  • Save vialyx/054d3a4449bce8e00c78e883e04bdc0e to your computer and use it in GitHub Desktop.
Save vialyx/054d3a4449bce8e00c78e883e04bdc0e to your computer and use it in GitHub Desktop.
enum Weekday: Int {
case sun
case mon
case tue
case wed
case thur
case fri
case sat
var value: String {
switch self {
case .sun:
return "sun"
case .mon:
return "mon"
case .tue:
return "tue"
case .wed:
return "wed"
case .thur:
return "thur"
case .fri:
return "fri"
case .sat:
return "sat"
}
}
}
let dayNumber = 1
let weekday = Weekday(rawValue: dayNumber)
print("weekday name: \(weekday.value)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment