Articles, podcasts and news about Swift development, by John Sundell.

Newsletter: June 2020

Published on 01 Jun 2020

👋 Hi everyone

With just three weeks to go until the start of this year’s edition of WWDC, things are busy over here at Sundell HQ. Not only am I going through my regular routine of upgrading all of my projects to the latest Swift and Xcode releases (something that I always recommend doing in preparation for the new beta SDKs), I’m also building a brand new version of WWDC by Sundell — my dedicated website for covering Apple’s conference and the new technologies and APIs unveiled at it.

This year, that site will be even bigger and more ambitious than last year — with more guest writers, interviews, videos, and the same in-depth code-level coverage of the key conference announcements as last year. I can’t wait to show you the new site, which launches on June 17th, and it will once again be completely free and available to everyone around the world.

But for now, let’s get started with this month’s recap of everything that’s new on Swift by Sundell. Hope you’ll enjoy it, and if you have any questions or feedback, you’re always welcome to reach out.

📖 Weekly articles

For 172 weeks, I’ve been publishing a new article about Swift every Sunday. These articles were added during the past month:

The different categories of Swift protocols

Swift’s many protocols can, in general, be split up into four main categories. Let’s go through them, and how keeping them in mind can help us write well-formed protocols that are consistent with those found in the standard library.

Propagating user-facing errors in Swift

In this article we’ll take a look at a few techniques that can make it much simpler to propagate runtime errors to our users, and how employing some of those techniques could help us present richer error messages without having to add a ton of complexity within each UI implementation.

Avoiding deeply nested Swift code

This article contains a number of techniques that can help us make our code easier to read, test and maintain, by reducing the amount of indentation within it. It’s not just about code style, I promise.

Getting the most out of Xcode Previews for SwiftUI

Let’s take a look at a number of techniques, patterns, and ways of structuring UI code that can help us get the very most out of Xcode’s SwiftUI-powered preview system.

Designing reusable Swift libraries

My latest weekly article is about library development, and contains a few techniques and principles that can be good to keep in mind when designing and building reusable Swift libraries.

✅ Basics

With the Basics series, my goal is to build up a comprehensive library of articles that cover most of the core aspects of Swift and iOS development. This article was published during the past month:

Properties

Let’s take a look at a few examples of the various kinds of properties that Swift supports, and what some of their different characteristics are.

🎧 Podcast episodes

The Swift by Sundell podcast is a bi-weekly show featuring special guests from all around the Swift community. You can find it in your podcast player of choice, for example Apple Podcasts or Overcast. These episodes were published during the past month:

72: “Many layers of SwiftUI”, with special guest Tobias Due Munk

Tobias Due Munk joined me to talk about using SwiftUI to build prototypes, how third party developers can extend SwiftUI’s built-in APIs in various ways, and to discuss the challenges of writing highly dynamic systems in Swift.

73: “Truly a general-purpose language”, with special guest Kilo Loco

Kyle Lee, also known as Kilo Loco, joined me to go behind the scenes of Publish — the static site generator used to build Swift by Sundell. Also, how to make a code base accessible to new team members, learning from open source, getting started with Swift-based web development, and much more.

⭐ Swift tips

I love to share shorter tips, tricks and techniques with the community. These are the tips that I shared during the past month:

Inferred generic type constraints

How generic type constraints can sometimes be automatically inferred by the compiler, enabling us to omit them within some of our function declarations.

Using test assertion messages as comments

Often when writing tests, we might want to add some additional information to our code, for example in order to give debugging hints in case of a future failure. Let’s take a look at how we can add such information using custom test assertion messages.

Building an Observable type for SwiftUI views

An example of building a reusable ObservableObject that makes it easy to observe a single value within a SwiftUI view.

Quickly replacing singletons with functions

Testing code that uses singletons may at first seem really difficult. However, thanks to Swift’s first class function capabilities, there are a few tricks that we can employ to make such code completely testable without having to introduce any new types or protocols.

đŸ“ș Videos

Swift Clips is a new series of shorter YouTube videos covering Swift tips and techniques. This video was published during the past month:

Key paths and functions

Let’s take a look at how Swift’s key paths work, and how they relate to functions — both in terms of what comes built into the language itself, and what kind of utilities that we can write ourselves to form some really nice convenience APIs.

➕ More to read and listen to

Special articles and podcasts that are not part of my regular schedule. Feel free to check them out if you’re looking for something new to read or listen to.

Making Xcode UI tests faster and more stable

In my latest guest article on the Bitrise blog I share my favorite tips and techniques for making UI tests easier to write and, perhaps more importantly, to maintain.

Why does Swift by Sundell not use any client-side JavaScript?

The story of why I chose not to use any client-side JavaScript when building the new version of Swift by Sundell, and why I thought that it was important to emphasize that fact on the website itself.

My origin story on the iOS Dev Discussions podcast

I joined my friend Sean Allen on his podcast to share my “origin story” — that is, how I got started with programming, how writing and podcasting ended up becoming my full-time job, how I’ve been progressing through my career, and examples of the mistakes that I’ve learned from along the way.

Stacktrace

Stacktrace is a weekly podcast that I do with my good friend Gui Rambo, which used to be focused mainly on Apple news, but has since become much more developer-focused — with technical deep-dives and “behind the scenes” discussions on every episode.

🙌 You’re all caught up!

I hope you enjoyed this summary, and all of the content that I published during May. Like always, I’d love to hear your feedback — so feel free to either email me, or contact me on Twitter @johnsundell. I read every single piece of feedback that I get, and I try to reply to as many people as I possibly can.

Thanks for reading! 🚀