Issue #53
Hi there, welcome to the 53rd issue of iOS Code Review! It's so nice to be back π
It's almost conference season π€ I'm going to a couple of conferences this autumn. I will speak at NSSpain and hopefully get a visa in time attend iOSDevUK. Will I see you there? Let me know if you're also planning to go, let's meet!
If you're not going to any in-person conferences, perhaps check out the online Mobile DevOps Summit by Bitrise, who are so kind to be sponsoring multiple issues of the newsletter βΊοΈ
Also a small personal update: I've changed my last name to Vatmakhter - which is my grandparents family name. It's something I've been wanting to do for many years, and finally I could πβΊοΈ I'll slowly propagate it throughout my online presence - it's still me π
A two-day, free event with 40+ workshops and sessions brought to you by 50+ industry-leading speakers from eBay, Reddit, AWS and more. Learn from real-world examples of successful Mobile DevOps implementations. Check out our speaker list
Enum-based sheet presentation
Displaying multiple sheets from one view can quickly lead to repetitive code segments in SwiftUI. By using an enum to represent which sheet to present, we can make the code more maintainable. This, and more learnings can be found in Antoine's article below.
Using #error
Swift has a compiler directive that allows us to issue a compilation error.
This can be useful in a few ways, for example to prevent the app from compiling in certain conditions.
One of my usecases is when you're iterating over a feature and want to merge to develop
, and want to make sure the app can't be released in an unfinished state.
func calculateStuff() {
print("TBD")
#if RELEASE
#error("calculateStuff feature is not implemented!"
#endif
}
Here's Vincent sharing another scenario, where package authors can use #error
in their example code, to bring user's attention where they need to fill out the api key.
Text + Text
A handly alternative to AttributedString
in SwiftUI:
A refactoring story
Every codebase has a piece of code similar to this. Here's Jon demonstrating a step-by step refactoring to make it error-proof:
βοΈ
Alright, that's it for today! Let's spread the good code vibes β¨π§πβοΈ
Thank you to Bitrise for sponsoring this issue β€οΈ
And I always want to hear from you -just reply to this email :)
Member discussion