New Discover page: Codable
Discover Swift’s Codable protocol, how to fully leverage its compiler synthesis features, and how to use its surrounding APIs to write efficient serialization code.→ Check it out
View ArticleUsing Combine’s share operator to avoid duplicate work
When writing asynchronous code using Combine, we might sometimes want to share the result of a given set of concurrent operations, rather than performing duplicate work for each one. Let’s take a look...
View ArticlePreviewing SwiftUI views in landscape
Starting in Xcode 13, SwiftUI views can now be previewed in landscape orientation using the new previewInterfaceOrientation modifier. For example, here we’re previewing a MenuView in both portrait and...
View ArticlePodcast: “Building various kinds of editors”, with special guest Marcin...
Marcin Krzyzanowski returns to the show to talk about building editors for Swift code, backend-driven user interfaces, and more. Also, the challenges of working with text-based data, the pros and cons...
View ArticleProgrammatic navigation in SwiftUI
By default, the various navigation APIs that SwiftUI provides are very much centered around direct user input — that is, navigation that’s handled by the system in response to events like button taps...
View ArticlePodcast: “Opportunities for optimization”, with special guest Christian Selig
Christian Selig returns to the show to talk about how he used the new Safari extension system on iOS to build Amplosion and Achoo, the pros and cons of open source, and how developers can utilize other...
View ArticleWhich of the SwiftUI APIs introduced in iOS 15 are backward compatible?
As a general rule of thumb, all of the APIs and system features that Apple introduces in a given version of iOS can only be used when targeting that particular version, or any subsequent ones.However,...
View ArticleBuilding editable lists with SwiftUI
To say that SwiftUI’s List is the equivalent of UIKit’s UITableView is both true and false at the same time. It’s definitely true that List offers a built-in way to construct list-based UIs that are...
View ArticleSpecialized extensions using generic type constraints
Combining Swift’s powerful generics system with the fact that any Swift type can be extended with new APIs and capabilities enables us to write targeted extensions that conditionally add new features...
View ArticleNew Discover page: Generics
Learn how to fully utilize Swift’s powerful generics system to write reusable types, functions, extensions, and protocols.→ Check it out
View ArticleSwift’s new concurrency system gains backward compatibility in Xcode 13.2
Starting in Xcode 13.2, Swift’s new suite of concurrency features are now backward compatible all the way back to iOS 13, macOS Catalina, watchOS 6, and tvOS 13. The new concurrency features include...
View ArticleMaking async system APIs backward compatible
Although Swift 5.5’s new concurrency system is becoming backward compatible in Xcode 13.2, some of the built-in system APIs that make use of these new concurrency features are still only available on...
View ArticlePodcast: “UIKit in 2021”, with special guest Ben Scheirman
Ben Scheirman returns to the show to talk about modern UIKit-based app development, how UIKit has evolved over the past few years, and how its API design and usage has been influenced by the...
View ArticleUsing Swift’s concurrency system to run multiple tasks in parallel
One of the benefits of Swift’s built-in concurrency system is that it makes it much easier to perform multiple, asynchronous tasks in parallel, which in turn can enable us to significantly speed up...
View ArticlePodcast: “Concurrency and Swift-DocC”, with special guest Marin Todorov
Marin Todorov returns to the podcast to discuss Swift’s new concurrency system and its newly announced backward compatibility, his new book about that topic, and his work on Apple’s open source...
View ArticleBuilding async and concurrent versions of forEach and map
If we think about it, so much of the code that we write on a daily basis essentially consists of a series of data transformations. We take data in one shape or form — whether that’s actual model data,...
View ArticleUsing count vs isEmpty to check whether a collection contains any elements
In Swift, there are essentially two main ways to check whether a given collection is empty. We can either check if the collection’s count is equal to 0, or we can use the dedicated isEmpty property.At...
View ArticleUnit testing Swift code that uses async/await
Writing robust and predictable unit tests for asynchronous code has always been particularly challenging, given that each test method is executed completely serially, line by line (at least when using...
View ArticlePodcast: “Code maintenance”, with special guest Nick Lockwood
Nick Lockwood joins John for a discussion about maintaining Swift code bases — from open source projects, to ones worked on by teams of various sizes. Also, the design of ShapeScript, using async/await...
View ArticleSwift actors: How do they work, and what kinds of problems do they solve?
Since the very first version of Swift, we’ve been able to define our various types as either classes, structs, or enums. But now, with the launch of Swift 5.5 and its built-in concurrency system, a new...
View Article