Let's call some function, which has an escaping closure as a parameter:
someFunc(complition: {
self.someAnotherFunc()
})
is equivalent to:
someFunc(complition: { [self] in
someAnotherFunc()
})
is equivalent to:
someFunc(someAnotherFunc)
Was that correct?
I think that was correct.
self is capturing strongly above.
And what about case of [weak self]?
Is the only way we can write?:
someFunc(complition: { [weak self] in
self?.someAnotherFunc()
})
Can't we somehow to write it like someFunc(someAnotherFunc)?
P.S. Okey, there is one more way to write it, I know:
someFunc { [weak self] in
self?.someAnotherFunc()
}
But what about even more concise form?