mardi 12 décembre 2017

Is it possible to get the containing type from an instance of a nested type?

Given the following code

class MyClass{

    enum MyEnum{
        case first
        case second
    }
}

func test(someValue:Any){

    // What code goes here

}

If I call the test function like so...

test(MyClass.MyEnum.first)

What code needs to be inside test(someValue:) so that internally it can get MyClass?





Aucun commentaire:

Enregistrer un commentaire