class func sharedInstance()-> GlobalConstant {
struct YRSingleton{
static var predicate:dispatch_once_t = 0
static var instance:GlobalConstant? = nil
}
dispatch_once(&YRSingleton.predicate,{
YRSingleton.instance = GlobalConstant()
}
)
return YRSingleton.instance!
}
原文:http://www.cnblogs.com/shidaying/p/4371217.html