 iOS Code Review | Curated code improvement tips

By  iOS Code Review

Bi-weekly newsletter amplifying code improvement tips from the Apple developer community. Swift, Objective-C, iOS, macOS, SwiftUI, UIKit and more. Curated by Marina Gornostaeva and published every other Thursday.

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy and understand that  iOS Code Review | Curated code improvement tips will receive your email address.

820

subscribers

10

issues

#10・

 iOS Code Review | Curated code improvement tips - Issue #10

While it's undoubtedly a superior way to write asynchronous code, I generally stayed away from async/await-related tips, because no one could really use them yet. I wrote about the issues few weeks ago. But not for much longer!Xcode 13.2 beta was released yes…

 
#9・

 iOS Code Review | Curated code improvement tips - Issue #9

SwiftUI previews can be very handy for other use-cases besides previewing SwiftUI views. You can use previews to preview UIKit views, which can save you dozens of hours in rebuilding to see your changes:

 
#8・

 iOS Code Review | Curated code improvement tips - Issue #8

Considering to start using async/await for real? Here are some things worth knowing before you do. Backporting to older iOS versions is proving challenging and might not happen; and a few serious issues and crashes have been found on the current version shipp…

 
#7・

 iOS Code Review | Curated code improvement tips - Issue #7

It's almost a tradition now to start the newsletter with a tip about an obscure Combine issue... This time, it turned out that breakpointOnError() crashes apps. To solve this, you can make an extension that conditionally uses this only if debugger is attached…

 
#6・

 iOS Code Review | Curated code improvement tips - Issue #6

Have you seen code that's running multiple async calls in a loop, calling completion on the last item in the loop? Or counting the number of callbacks called? I've seen it a lot, and the last time has prompted me to share this tip 🙂DispatchGroup allows you to…

 
#5・

 iOS Code Review | Curated code improvement tips - Issue #5

Do you remember about this obscure feature added in iOS 14? Holding the back button shows the navigation stack history and lets you navigate to any item. Cool feature, right? Not so fast...The titles are taken from the back button. If you're still hiding the …

 
#4・

 Code Review | Curated code improvement tips - Issue #4

@swiftandtips found a well-structured writeup on when to use and not to use [weak self] in closures. Here's a concise chart to help you decide. If you also want to learn the why's, read the full article: You don’t (always) need [weak self] by @BesherMaleh

 
#3・

 Code Review | Curated code improvement tips - Issue #3

Last week a particular topic resonated through the community: the mental toll the different architectures bring on developers. The issue is especially prominent for complex architectures such as VIPER, which is known for having many similarly-named small file…

 
#2・

 Code Review | Curated code improvement tips - Issue #2

If you write Swift, most likely you use structs a lot. John Sundell goes in depth on how marking functions in structs mutating can help you make code more structured and concise.

 
#1・

 Code Review - Issue #1 | Highlights from 2020

While multiline change suggestions were introduced on Github all the way back in February 2020, it's such a time saver during code reviews, that it is worth reminding about. When a you use change suggestions in PR comments, the changes can be incorporated aut…