Enum class in swift
<p>Im trying to create an enum class with a type and a function that returns all the types.</p>

<p>Initially I have my enum in my object class and a function that returns these as an array:</p>

<pre><code>class someClass: Mappable {

enum Type: Int {
    case A = 0
    case B = 1
    case C = 2
        }
    }
}

func getAllTypes() -&gt; [Type] {
    return [Type.A, Type.B, Type.C]
}
}
</code></pre>

<p>The reason i want to extract this out of my object class is because this type is also used in other classes and i don't want to duplicate any unnecessary code.</p>

<p>I can manage to subclass the enum but not the function that returns all the types in an array.</p>

<p>Any help will be appreciated.</p>