I spent the whole morning thinking about whether it's appropriate to send out an issue today. For the sake of consistency I decided in favour of delivering on the promise of code improvement tips in your inbox every two weeks.
This time I got no cheerful words though. If you're able to enjoy something today - I hope you enjoy these tips.
Uninitialized variables + defer = 👯♀️
One of my favourite combinations of Swift's features:
HttpServer or HTTPServer?
Swift API design guidelines have the answer:
Representing measurement units
Measurement is a type that represents a numeric quantity labeled with a unit of measure, with support for unit conversion and unit-aware calculations.
MeasurementFormatter has a range of options for presenting measurements in a localised way. Both are available since iOS 10. Starting iOS 15, SwiftUI's
Text supports measurement formatting too:
The missing SwiftUI docs
SwiftUI fully documented, with visual examples on every page.
Is there the best architecture?
What works for a tiny startup won't work for a mature product with a large dev team, and vice versa. It's obvious, but still worth remembering when we discuss architectures in abstract.
Alright, that’s it for today.
Wherever you are, I hope you're safe.
I’d love to hear from you - reply to this email or reach out on Twitter via @ios_code_review 🙌