单例的创建
class Apple: NSObject {
//创建单例
static let shared : Apple = {
let shared = Apple()
return shared;
}()
//懒加载
lazy var name: String = {
return ""
}()
}
单例的创建
class Apple: NSObject {
//创建单例
static let shared : Apple = {
let shared = Apple()
return shared;
}()
//懒加载
lazy var name: String = {
return ""
}()
}
本文标题:单例
本文链接:https://www.haomeiwen.com/subject/mxpzxxtx.html
网友评论