Issue #43
Hi there, welcome to the 43rd issue and happy valentines day 💌
Enjoy the reading!
In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it simple by providing a backend and a wrapper around Apple's StoreKit and Google Play Billing. Get started for free.
Learn more
Documenting hacks
How often do you add dispatch.async as a way to fix a bug? Hopefully not often! The core of solving a bug without causing more bugs, is understanding the root cause and fixing that.
But sometimes, even though we find the root cause, there's no way to address it, so a hacky workaround is necessary. In that case, make sure to add a detailed comment next to the hack. For your colleagues and your future self!
Two ways to mock in tests
Here's Manuel describing two ways to implement a loading view model and its tests. One employs protocols for dependency injecion, and another uses closures. The same example code is used in both approaches, so you can easily compare and pick your favorite. Beautiful and concise articles, with links to GitHub included.
Don't subclass URLCache
Few days ago I saw a post by Nikita on Mastodon asking if anyone could help him solve a bug with his URLCache
subclass not actually caching anything. Some days later, he wrote a post with his findings.
Turns out, nowadays URLCache
is not subclassable anymore, even though the documentation states that it is. Instead, we should build our custom caching logic above the url loading layer.
What's new in Swift - a refresher
Sometimes when new stuff is released in Swift or the SDK, it gets forgotten because you can't use it right away. Swift versions is one of those things - they are released even before Xcode is.
So here's a refresher on the lovely Swift features we can now introduce in our projects on Xcode 14+ - the shorthand if let
, new regex syntax, and more. Available in video and article format:
Merge when ready on GitHub
Are you working in a repo where you have to wait for CI to finish before merging a pull request? Then GitHub's new merge queues feature is going to improve your day-to-day :)
Before merge queues, developers were often required to update their pull request branches prior to merging to ensure their changes wouldn't break the main branch when merged. Each update resulted in a fresh round of continuous integration (CI) checks that would have to finish before the developer could attempt to merge. If another pull request got merged, every developer would have to go through the process again.
Even if you're not needing the queue part, the "Merge when ready" button is the feature I've been missing all along.
✌️
Alright, that's it for today! Thank you to RevenueCat for sponsoring this issue ❤️
I'm curious if you found one of the tips particularly interesting - let me know by replying to this email!
Member discussion