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

时间:2014-07-01 06:30:52   收藏:0   阅读:340
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

原文:http://blog.csdn.net/woshiwupo/article/details/35988473

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!