Closed wnagrodzki closed 5 years ago
I think using recaptured weak
vs capturing directly should be decided on a case-by-case basis. I imagine there can be scenarios where the captured object’s lifetime should be extended until the closure is executed.
@pwetrifork I corrected the paragraph as it was misleading and did not represent what I meant.
@pwetrifork @moskacz Does it looks good?
According to the discussion at https://bugs.swift.org/browse/SR-6156, rebinding self under the same name confuses the debugger
This should be fixed in Swift 4.2: https://github.com/apple/swift-evolution/blob/master/proposals/0079-upgrade-self-from-weak-to-strong.md
It looks like the change in 4.2 was only about skipping the backticks, the debugger bug is still there
@pwetrifork Yes, thanks, I added note about that issue in quotation below the code-listing.
@moskacz What is your opinion?
I think we should decide which variable name is preferred until bug is fixed. Seems like strongSelf
is used very often by developers, so it might be right choice.
@Moskacz Ok, I updated the text.
If you are breaking reference cycle for an object bind it to a strong reference for the duration of the closure’s execution.
Related