0

How do you do the following in Swift?

[SomeClass class]

The class method of NSObject is only available to Objective-C. How would you do the equivalent in Swift? I'm interfacing with an Objective-C 3rd party library.

Imanou Petit
  • 89,880
  • 29
  • 256
  • 218
Mark Horgan
  • 3,243
  • 4
  • 27
  • 28
  • See also: http://stackoverflow.com/questions/24006165/how-do-i-print-the-type-or-class-of-a-variable-in-swift http://stackoverflow.com/questions/24101450/how-do-you-find-out-the-type-of-an-object-in-swift – Matt Gibson Aug 10 '14 at 21:28

1 Answers1

3

The answer seems to be:

SomeClass.self

and if you have an instance:

someInstance.dynamicType
Mark Horgan
  • 3,243
  • 4
  • 27
  • 28