4 min read

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

Runway: Build the perfect release train 
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.

swift-evolution/proposals/0413-typed-throws.md at main · swiftlang/swift-evolution
This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. - swiftlang/swift-evolution

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.

Making illegal states unrepresentable | Swiftology
In state modeling, perfection is achieved not when there is nothing more to add, but when there is nothing left to take away.

@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

New in SwiftUI: the macro @Entry — Swift with Vincent
You’re more of a video kind of person? I’ve got you covered! Here’s a video with the same content than this article 🍿

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.

GitHub Copilot for Xcode
Microsoft released an Xcode extension in a surprising turn of event

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. 

Implement blurring when multitasking in SwiftUI
Learn how to implement automatic screen blurring in SwiftUI apps to enhance user privacy when the app enters multitasking mode.

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.

How to expedite an app review on the App Store
A guide on how you can use expedited app reviews in exceptional circumstances to get your app reviewed faster than normal on the App Store.

✌️
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 ❤️