4 ms·
One thing I've found frustrating with Swift, and that we've had to deal with in libs we've built, is that there is an unavoidable boilerplate of placing an `[un
by wxs 12y ago
One thing I've found frustrating with Swift, and that we've had to deal with in libs we've built, is that there is an unavoidable boilerplate of placing an `[unowned self]` at the top of your callbacks (e.g. `map` in the linked framework), or else you introduce a reference cycle.
If you forget this `[unowned self]`, which is very easy to do, everything compiles fine and now you have a subtle memory issue to track down. I wish there was a language construct to allow you to define closures that have every captured variable unowned (or weak) by default.
I would, at the very least, emphasize somewhere in your docs with big bold letters how important it is to add the boilerplate, or users of Bond will definitely get bitten by this.
- srdanrasic 12y agoI agree. Thanks, it's a great suggestion.