Issue #41
Hi there,
Welcome to the 41st issue of iOS Code Review 👋 I hope you enjoy the reading!
Coduo lets you share and collaborate in Xcode by streaming your Xcode project live into any browser, with full 2-way control.
Simply invite a friend with a Coduo link, they open it in their browser, and just like magic - you are both working on the same Xcode project, with voice chat and full mouse & keyboard control for both users.
Try Now
My favorite architecture
Here's my favorite architecture stack for UIKit apps. I'm planning to write more about the different aspects of it - got a few questions in the comments there. What would you like to hear about first? (let me know by replying to this email)
The architecture used (my goto):
— Marina Gornostaeva ✨ (@hybridcattt) January 9, 2023
- coordinators
- MVVM
- repository pattern w/ simple networking & Codable
- UIKit with SwiftUI previews
- Modern collection views w/ compositional layout & diffable datasources
- Container view controllers
- Design system w/ UIButton.Configuration
VStack, LazyVStack vs List
Here Pitt compares the performance of the three options, on a real app. Excellent explanation of the differences, and tl;dr - never use VStack
for lists with many elements.
In case you need to implement a long list with infinite scrolling, here's Donny summarizing how to achieve it with LazyVStack
and List
:

On technical debt
Loving the analogies with the financial world. Technical debt is like actual debt, we borrow to be able to afford something we otherwise can't. Improving or cleaning up code is like an investment - we spend time to get something in return later.
How do you decide whether to clean up a piece of code or to leave it alone?
— Jason Swett (@JasonSwett) January 5, 2023
And how do you decide how much to clean it up?
Think of it like this: every cleanup job is a bet that your time spent will be paid back by easier future maintenance. Aim for sound bets.
Unwrapping optionals
Three ways to unwrap an optional, shaped as a meme:
(from @DonnyWals) pic.twitter.com/mqzCDszyLG
— a meme page to check while Xcode is indexing files (@ios_memes) January 12, 2023
Is this good code?
My galaxy-brain answer to this would be: as long as this function is covered by extensive unit tests, it doesn't matter that much how it's implemented.
Junior eng: this is good code
— Willem Spruijt (@wspruijt) January 17, 2023
Medior eng: hold my beer 🍺
Senior eng: this is good code https://t.co/YpHvucX3O6
✌️
Alright, that's it for today! Thank you to Coduo for sponsoring this issue.
I'm curious if you found one of the tips particulary interesting - let me know by replying to this email!
Member discussion