Issue #72
Hi there, welcome to the 72nd issue of iOS Code Review! Today I’m joined by J’aime, who is your author for today. Enjoy! 👇
Whew! What a whirlwind summer and fall, eh? WWDC Announcements, Swift 6, AI advancements, plus in-person conferences and events are making a comeback. We have a few selections from these developments here for your reading pleasure.
Thank you, Marina, for welcoming me to join you for this week's iOS Code Review. It's been heaps of fun putting this issue together with you.
– J'aime Ohm, enjoyer of newsletters and director of One More Thing
Release trains are not a silver bullet, but they can help you ship new versions of your app more predictably, reduce risk, get feedback from users faster, and improve collaboration and planning within your team.
Here’s how to build the perfect mobile release train
Swift 6: Typed Throws
Throwing functions can now throw typed errors. You can add a type throws(ErrorName)
in the function declaration. Or, add a type in a do(ErrorName)...catch
declaration.
How do we make illegal states unrepresentable?
DONT: have a model that supports an `illegal state`, like modeling no payment method (nil, nil) as shown below.
struct PaymentMethod: Codable {
let creditCard: CreditCard?
let giftCard: GiftCard?
}
DO: have a model that supports only `legal states`, like modeling only one or more payment methods, as shown below.
enum PaymentMethod {
case creditCard(CreditCard)
case giftCard(GiftCard)
}
This article has various examples of the clever use of Swift types to make such states impossible.
@Entry in SwiftUI
This macro condenses the declaration of Environment
, Transaction
, Container
, and Focused
values.
extension EnvironmentValues {
@Entry var myCustomValue: String = "Default value"
}
Read about the before-and-after in the article below, and check out official documentation
Videos from SwiftCraft UK 2024
Videos from SwiftCraft UK are up on YouTube. Thank you again to SwiftCraft UK for sponsoring this newsletter in March and April of 2024.
Copilot for Xcode is here
The popular AI coding tool Copilot
has now been released by Github as an offical extension for Xcode. To try it you need to disable Xcode 16's predictive code completion.
A couple of how-tos
Improving User Privacy in Multitasking by Blurring Views
When the environment variable scenePhase
changes to inactive
or background
, sensitive views can be animated with blur by using modifier .blur(blurRadius:
to 20.
When you really really really need your app reviewed quickly
Go to contact us at the bottom of developer.apple.com and keep selecting an option with App Review in it until you reach Expedited App Review Request.
✌️
Alright, that's it for today! Let's spread the good code vibes ✨🧘🌈☀️
You can now use the comment section on the website to share your thoughts.
Thank you to Runway for sponsoring this issue and thank you to J’aime for joining us today ❤️
Member discussion