Is it possibile to retrive the data Type
from a class in Swift language
?
This is an example :
class Test : NSObject
{
let field1 : String
let field2 : Int
init(value1 : String, value2 : Int)
{
field1 = value1
field2 = value2
}
}
let test1 = Test(value1: "Hello", value2: 1)
//this code return the same string with class name (__lldb_expr_129.Test)
let classString = NSStringFromClass(test1.classForCoder)
let className2 = reflect(test1).summary
//this code return the same ExistentialMetatype value and not the Tes or NSObject type
let classType = reflect(test1).valueType
let classType2 = test1.self.classForCoder
//this return Metatype and not the Test or NSObject type
let classType3 = test1.self.dynamicType
Is there a method to retrive the Test
type and not the ExistentialMetatype
or Metatype
value ?