Not Only Swift

By Peter Friese

Not Only Swift Weekly - Issue #4

#4・
261

subscribers

18

issues

Subscribe to our newsletter

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy and understand that Not Only Swift will receive your email address.

Peter Friese
Peter Friese
Hello!
Is it just me, or does it feel like time is flying? Maybe it’s the constant drumbeat of product announcements and releases - last week, Apple announced new hardware (did you (pre-)order anything?), and this week, they officially released Swift 5.5. And - of course - iOS 15 has been released, and if the excitement and buzz on Twitter is anything to go by, many developers have updated their apps to support the new APIs on day one!
The year isn’t over yet, and I am sure we will see even more exciting product announcements and launches in the remaining months of 2021.
I hope you enjoy this fourth edition of Not Only Swift Weekly - if you do, please share it with a friend. And as always, feel free to share your feedback with me!
Thanks for reading!
Peter

What I am working on
The fourth part of Building SwiftUI Components is out! Did you ever wonder how onDelete,  onAppear or task are implemented? These methods allow developers to register actions on views that will be executed at certain times. In this episode, we look at how to implement an action handler that will be called to perform custom validation logic.
SwiftUI: Custom Validation Handling
I also published the source code for this and all previous episodes of the series.
Swift
Swift 5.5 is now officially released. Most of us will get it together with Xcode 13, but if you’re on a non-macOS platform, you can get the toolchain from the downloads section on Swift.org.
The blog post highlights the impressive list of Swift Evolution proposals that made it into version 5.5, and you will find that most of them revolve around Swift’s new concurrency model.
If you haven’t had time to dive into Swift’s new concurrency model, there are a number of options to get up to speed:
1. Watch all the WWDC 2021 videos about concurrency. If you need a viewing guide, check out this thread.
2. Read Andy Ibanez’ excellent article series
Actors are an important concept in Swift’s new concurrency model - they help us write code that is free from data races and deadlocks. If you’ve watched Apple’s WWDC videos closely, you will remember they mentioned that “Actor reentrancy prevents deadlocks and guarantees forward progress, but it requires you to check your assumptions across each await.” Here is Lee Kah Seng with a real-world example that nicely highlights the problem, and two strategies to handle it.
Syntax: if case let 
In a piece of code I wrote for this PR, I wanted to use if case let , but - I am sure you can relate - I didn’t know the syntax by heart. Not to worry - https://goshdarnifcaseletsyntax.com/ had me covered.
It turned out that our linter had a different opinion on which syntax to use, so we had a little fight about whether to use if case .success(let fruits) = fruitResults or if case let .success(fruits) = fruitResults
What’s your preferred way to do pattern matching in Swift?
(Developer) Productivity
Trisha Gee dives into a discussion whether you should get good at reading code or write more readable code. She makes some very good points, and I’ve found myself thinking about some of the aspects of readable code recently. As a content creator, I want to make sure the code I present in my videos and articles is easy to understand for my audience, and helps to transport the concepts I want to talk about. At the same time, I want to write code in an efficient and idiomatic way. The bottom line, as Trisha puts it in her article, is reading code is a skill. The more code you read, the better you get at it. And with so much of the code out there being open source, there really is no shortage of great material!
Firebase 🔥 / Cloud 🌥
As I mentioned previously, we are cooking up some really exciting things at Firebase. A lot of our work happens out in the open, so if you follow our repositories closely, you might be able to get some ideas of what to expect in the coming weeks and months.
Oh, and today, the official @Firebase account tweeted this:
We’ve gotten used to treating our email addresses as sort of a unique identifier, but they come with a number of challenges. For example, when a user signs up to your app using email and password authentication, you should perform an email validation. For example, to make sure the user didn’t accidentally (or deliberately) misspell their email address. It’d be pretty upsetting for them if they need to reset their password, but the password reset email never arrives in their inbox.
Firebase Authentication treats email addresses as verified if the user completed the Firebase verification flow, or if the email has been verified by a trusted Identity Provider. Some IdPs allow their users to change their email address without re-verification - these are considered untrusted. To learn more about this, read the documentation.
The Google Cloud team added an easy way to launch a Cloud Shell right from the documentation. No need to set up a test project to try a cool new feature you discovered in the docs - just jump into the Cloud Shell - without leaving the page.
Podcasts
At the beginning of the pandemic, I established a fake commute to make sure I get enough exercise and don’t just walk between my bed, the kitchen, and my desk. To keep me entertained, I started listening to podcasts. Hundreds, even thousands of them. One of the series I enjoyed very much is Land of the Giants by Recode. In previous seasons, they covered Amazon, Netflix, Google, and the delivery economy. In the upcoming season, Land of the Giants: The Apple Revolution, Recode’s Peter Kafka will explore the company that changed what a computer is — and then changed what a phone is. Check it out!
Did you enjoy this issue? Yes No
Peter Friese
Peter Friese @peterfriese

Xcode tips & tricks, Swift, SwiftUI, Combine, Firebase, computing and internet history, and - of course - some fun stuff.

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.