How do I write in Swift: [class MyClass]?

I want to refer to a class in Swift. In Objective-C, I wrote this expression: [MyClass class]

How does it work in Swift? I need him to assign him to a delegate.

I tried this: MyClass.class

but I get this error: The expected member name is the following "."


source to share

1 answer

In swift it is:

let type = MyClass.self


to get the type from the instance instead of:

var x = MyClass()
let type = x.dynamicType




All Articles