In Objective-C in non-trivial blocks I noticed usage of weakSelf/strongSelf.
What is the correct way of usage strongSelf in Swift? Something like:
if let strongSelf = self {
strongSelf.doSomething()
}
So for each line containing self in closure I should add strongSelf check?
if let strongSelf = self {
strongSelf.doSomething1()
}
if let strongSelf = self {
strongSelf.doSomething2()
}
Is there any way to make aforesaid more elegant?
strongSelf
here. It's just a variable name. Perhaps add the Objective-C code you're hoping to replicate? What you're doing here is no different from simplyself?.doSomething()
– Accustomed[unowned self]
in swift : #24320847 and dhoerl.wordpress.com/2013/04/23/… – Takao