Avatar
実際の強カウント数を取る方法 @swift-5.5.3 class Foo {} let foo = Foo() print("init Foo: refCount = \(_getRetainCount(foo))") do { var closure: (() -> ())? = { [foo] in _ = foo } print("init capture: refCount = \(_getRetainCount(foo))") _ = closure closure = nil } print("deinit capture: refCount = \(_getRetainCount(foo))") (edited)