Issue #29
Hi there,
As I'm writing this, I am recording a show-and-tell video sharing a bit about my process creating this newsletter. I'll share it on Twitter and in the next issue, so stay tuned :)
I hope you find something interesting in my collection today 👇
Implicit weak self is coming
Usually I don't share things that Cannot Be Used Yet, but this one got me really excited! Starting with a future version of Swift, we won't have to write self
inside closures after capturing it weakly:
swift-evolution/0365-implicit-self-weak-capture.md · apple/swift-evolution · GitHub
As of SE-0269, implicit self
is permitted in closures when self
is written explicitly in the capture list. We should extend this support to weak self
captures, and permit implicit self
as long as self
has been unwrapped.
The background modifier
In the past year the family of .background(...)
modifiers has evolved. Now it has a few versions, allowing to customise alignment, safe area ignoring behaviour, and shape style of the background. There's even a version without any parameters at all - it sets the background to a color fitting the current color scheme. All versions are listed here and are documented pretty well.
Testing the mocks
Stumbled onto a peculiar use-case for unit tests, and I've never seen it in real-life projects. Documenting mock behaviour via tests will often be seen as "too much", but it can come handy in cases when lots of tests rely on one mock.
Thread safety in Swift
A longer but worthy read about different ways to manage multithreading in Swift and their trade-offs.
Thread Safety in Swift
Concurrency is the entry point for the most complicated and bizarre bugs a programmer will ever experience. In this article, I'll share my favorite methods of ensuring thread safety, as well as analyzing the performance of the different mechanisms.
Starting with open source
If you want to contribute to a project but didn't know which one, here's a good collection:
🤘☮️
Alright, that’s it for today.
Did you enjoy this issue? Let me know by pressing the buttons below. If you enjoyed it, you can help grow the newsletter by spreading the word ☺️
Got feedback? Want to see more, or less of certain kinds of tips? I’d love to hear from you. Reply to this email or reach out on Twitter via @ios_code_review 🙌
Member discussion