swift 创建单例模式
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!
}