Search code examples
iosswiftclassequivalentanyobject

equivalent to [obj class] in Swift?


How to get the class of an anyObject type in Swift?

In Objective-C we can get it like so :

id obj = [obj class]

Solution

  • The equivalent of [obj class] in SWIFT is :

    obj.dynamicType