Open bibin-jaimon opened 10 months ago
class Capture { var value = 10 deinit { print("dinit") } } var instance: Capture? = Capture() let closureExpression: () -> Capture? = { [unowned instance] in return instance } let result: Capture? = closureExpression() instance = nil instance?.value = 100 print(result?.value)
The output will be 10 because even though the instance is nil, the result variable is having strong reference to the Capture instance.
10