Given the code below, is it possible in Swift to programmatically determine the number of values inside an enum? The goal is to avoid hard coding a number in order to randomly choose a type of this enum.
enum Direction: Int {
case North
case East
case South
case West
case Northeast
case Southeast
case Southwest
case Northwest
static func random() -> Direction {
return Direction(rawValue: Int(arc4random_uniform(8)) + 1)!
}
}