//单例
// Swift 1.2后,可以使用类变量
// Swift 1.2之前单例的写法
/*
class MyMangager {
class var sharedManager: MyMangager {
struct Static {
static var onceToken: dispatch_once_t = 0
static var staticInstance: MyMangager ? = nil
}
dispatch_once(&Static.onceToken) {
Static.staticInstance = MyManater()
}
return Static.staticInstance!
}
}
*/
// Swift 1.2之后的写法
classMyManager {
staticletshared =MyManager()
privateinit() { }
}