ios8 swift开发:显示变量的类名称

var ivar = [:]
ivar.className // __NSDictionaryI

var i = 1
i.className // error: ‘Int‘ does not have a member named ‘className‘

If you want to get the type of a primitive, you have to use bridgeToObjectiveC(). Example:

var i = 1

i.bridgeToObjectiveC().className // __NSCFNumber

println("\(object_getClassName(now))");

ios8 swift开发:显示变量的类名称,布布扣,bubuko.com

ios8 swift开发:显示变量的类名称

上一篇:从零开始学ios开发(十二):Table Views(中)UITableViewCell定制


下一篇:Android开发(20)--RadioGroup的使用