Home > AI > Uncategorized

swift-单例

class S_ShaderManager: NSObject {
    static let sharedInstance: S_ShaderManager()
}

检查单例
let a = S_ShaderManger.sharedInstance
let b = S_ShaderManger.sharedInstance
print(a)
print(b)
a,b内存地址一样,单例成功。

 

Related posts:

Leave a Reply