Issue #15
Hi there,
Hope your Thursday is going the way you want it to go 🌟 Let's dive into this week's highlights!
On mixing Swift and ObjC
Adding a shim layer is a great way to approach moving to Swift in an Objective-C codebase. I can confirm from hands-on experience practicing it successfully on large ObjC projects.
I had this tweet saved in bookmarks for a while, thinking maybe I'll write an article on it some day. But no need anymore - Steve himself just published a great article going deeper on this topic. Huzza! Here's the full article: An Approach for Migrating From Objective-C to Swift
Golden path
Wikipedia describes golden (happy) path as a default scenario featuring no exceptional or error conditions. Swift sure took it to heart by introducing the guard
statement. If you are not using it actively yet, maybe this is your sign 😀
@discardableResult
@discardableResult
is the proper way to silence the unused variable warning:
Lazy variables are not thread safe
Antoine explains how to avoid data races with lazy variables in this section: How to solve a data race. TL;DR: you can either make all operations with the variable on the same thread, or use actors - the new feature in Swift.
Spell check in comments
Did you know that Xcode has a built-in spellchecker for comments? That's been introduced in Xcode 11. I think it's strange that it's not enabled by default. @felibe444 wrote a quick guide on how to turn it on: Typos in Xcode – Never Again!
HIG for text
Made by @k_katsumi, Apple Localization Terms Glossary is a handy reference point for text in your app. You can easily refer to texts that Apple uses in their UI, as well as see corresponding localisations to other languages.
Another great resource in this area is Apple Style Guide, the official glossary of how to use certain terms. It's like Human Interface Guidelines but for text - definitely worth checking out.
Apple Localization Terms Glossary
An unofficial Apple localization terms glossary that allows you to search for standard localization texts provided by the Apple platform.
Apple Style Guide on Apple Books
This book provides editorial guidelines for text in Apple materials. Apple developers and third-party developers should follow this guide for customer-facing text.
🤘
Alright, that’s it for today.
Did you enjoy this issue? Let me know by pressing the buttons below, so I can improve the newsletter.
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