class NetWorkTools : NSObject{
static var once_t : dispatch_once_t = 0
static bar instance: NetWorkTools?
class func shareWorkTools()->NetWorkTools{
dispatch_once(&once_t{
}){
}
// swift 单例子
static let instance:NetWorkTools = NetWorkTools()
class func shareNetWorkTools() -> NetWorkTools{
return instance
}
}
}
原文:http://www.cnblogs.com/1018475062qq/p/6270709.html