swift 使用计算属性+结构管理内存
class GooClass {
deinit {
print("aaaaaaaa")
}
var str = "gooClass"
}
struct GooStruct {
var goo = GooClass()
}
extension ViewController{
var gooStruct:GooStruct {
get {
return GooStruct()
}
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
print(self.gooStruct.goo.str)
}
}
我思故我在