4 ms·
A cursory read of this post made me glad I don't need to use Swift It seems like there are lots of footguns. > This attribute indicates that a type in a metho
by foundart 2y ago
A cursory read of this post made me glad I don't need to use Swift
It seems like there are lots of footguns.
> This attribute indicates that a type in a method declaration can be stored for later execution. Therefore, a closure marked @escaping can outlive the lifetime of the function itself — it “escapes” the function scope, stored to be executed later.
> Due to outliving the call site, escaping closures are a common source of memory leaks, which is why you’ll often be capturing [weak self] (or unowned self) to avoid this.