Swift 单例

192 阅读1分钟
import UIKit

class SingleInstance: NSObject {

    static let shared = SingleInstance()
    private override init() {}
    
    
}
// 调用 
let sing = SingleInstance.shared