Reputation: 571
Trivial but looking for confirmation I'm understanding correctly:
If we have a simple closure as so:
let closure = { [weak self] in
self?.doSomething()
}
Do we need to worry about weak/strong self within the method itself?
func doSomething() {
self.classString = "some new string"
// the self in this case will come from the weak self in the closure?
}
The following as I understand is unnecessary even though it'll be called from a closure:
func doSomething() {
weak var weakSelf = self
weakSelf.classString = "some new string"
}
Upvotes: 0
Views: 40
Reputation: 285079
No we don't need to worry because a method is not capturing anything.
Upvotes: 2