次のような関数にクロージャを渡した場合:
someFunctionWithTrailingClosure { [weak self] in
anotherFunctionWithTrailingClosure { [weak self] in
self?.doSomething()
}
}
self を[weak self]
のsomeFunctionWithTrailingClosure
キャプチャ リストで再宣言せずに宣言するとweak
、 のキャプチャ リストanotherFunctionWithTrailingClosure
self
はすでにOptional
型になっていますが、それもweak
参照になっていますか?
ありがとう!