Possible to pass an enum type name as an argument in Swift?
<p>I am trying to figure out if it's possible to pass around enum's type in the same way that you can pass <code>Class</code> objects in Swift.</p>

<p>My actual use case is a bit more complicated than this, but for discussion, let's say I have two <code>Int</code> enums:</p>

<pre><code>enum Foo: Int, CustomStringConvertible {
    case firstFoo = 0
    case anotherFoo = 1
    var description: String {
        switch self {
        case .firstFoo:
            return "Hello Foo"
        case .anotherFoo:
            return "Goodbye Foo"
        }
    }
}

enum Bar: Int, CustomStringConvertible {
    case firstBar = 0
    case anotherBar = 1
    var description: String {
        switch self {
        case . firstBar:
            return "Hello Bar"
        case . anotherBar:
            return "Goodbye Bar"
        }
    }
}
</code></pre>

<p>I would like to be able to write a function like this:</p>

<pre><code>func justAnExample(whichEnum: enum) {
    let val = whichEnum(rawValue: 0)
    print("description: \(String(val))")
}
</code></pre>

<p>And then use it like this:</p>

<pre><code>justAnExample(Foo)
// prints: "description: Hello Foo"
justAnExample(Bar)
// prints: "description: Hello Bar"
</code></pre>

<p>Is this possible?  If so, what is the signature of <code>whichEnum</code> in the function declaration?</p>