Using Swift’s defer keyword within async and throwing contexts
How Swift’s defer keyword can be incredibly useful when working with code scopes that have multiple exit points, such as throwing or async functions.
Articles and podcasts about Swift development, by John Sundell.
Presented by the Genius Scan SDK
How Swift’s defer keyword can be incredibly useful when working with code scopes that have multiple exit points, such as throwing or async functions.
Ben Scheirman returns to the show to discuss how Swift’s built-in concurrency features, such as async/await and tasks, can be used in practice when building apps for Apple’s platforms.
Managing an app’s memory is something that tends to be especially tricky when it comes to asynchronous code, so let’s take a look at how to do just that when using async/await.
A few examples on how to use Swift Concurrency to write asynchronous operations that are automatically retried if an error was encountered.
Creating convenience APIs that make it possible to convert async/await-based functions into Combine publishers.
How a custom SwiftUI button that’s capable of running asynchronous actions can be created, and how to make such a control versatile and easy to reuse across a project.
How we can use the built-in Task type to delay certain operations when using Swift’s new concurrency system.
Let’s explore how we could make use of Swift’s async/await capabilities to make our asynchronous code fully testable in a very lightweight way.
Tim Condon joins John to discuss how both client and server-side Swift developers could utilize the new built-in concurrency system, as well as how distributed actors and other upcoming language features might continue to make Swift even more capable on the server.
How Swift’s new Task type works, and how it enables us to encapsulate, observe, and control the way that our asynchronous code is executed.
Let’s explore Swift’s version of actors, and what kind of problems that we could solve by defining custom actor types within our code bases.
Let’s take a look at how to call async APIs within our unit tests, and also how async/await can be a great testing tool in general.
Let’s take a look at how we can utilize Swift’s built-in concurrency system when performing data transformations using functions like forEach and map.
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 documentation tool, Swift-DocC.
Let’s take a look at a few different ways to run multiple tasks in parallel when using Swift’s built-in concurrency system, and when each of those techniques can be especially useful.
How to make it possible to use async system APIs on earlier operating system versions.
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.
How the share operator enables a Combine publisher to be reused without requiring duplicate work to be performed for each subscriber.
How Swift’s AsyncSequence and AsyncStream APIs can be used to build asynchronous sequences, and how they relate to Apple’s Combine framework.
How Swift 5.5 enables computed properties to become either throwing or asynchronous, and what sort of situations that these new capabilities could become useful in.
Chris Lattner returns to the show to discuss Swift’s new concurrency features, the ongoing evolution of the language, and the importance of both language and API design. This, and much more, on this special 100th episode of the show.
Let’s explore how we can make it possible to call async/await-powered APIs within a Combine pipeline.
A look at how SwiftUI’s new refreshable modifier can be used to either add pull-to-refresh to a list, or to build completely custom reloading UIs and logic.
Let’s explore a few ways to “bridge the gap” between the new world of async/await and other kinds of asynchronous Swift code.
How the MainActor attribute eliminates the need for us to manually dispatch UI updates on the main queue when using Swift 5.5’s new concurrency system.
Doug Gregor from Apple joins John to discuss Swift 5.5’s new concurrency features in great detail. How do features like async/await and actors work under the hood, and how were those concepts adapted in order to feel right at home within Swift’s existing ecosystem? That, and much more, on this WWDC21 special episode of the show.
What’s the issue with calling UI-related completion handlers on background queues, and how can we ensure that all of our UI updates are performed on the main queue?
Brent Simmons returns to the show to discuss multi-threading and concurrency, and how to make good use of tools like Grand Central Dispatch. Also, building NetNewsWire in the open, the current state of SwiftUI, and the type of responsibilities that senior developers typically have.
How Combine’s operators for connecting and merging publishers can be used to solve real-world problems, such as nested network calls, handling multiple input sources, and more.
This week, let’s take a look at what goes into building a custom Combine publisher, and what sort of situations that might require us to do that.
In the second episode of Swift Clips, we’ll take a look at the DispatchQueue API, and how we can use it to write concurrent and asynchronous code in Swift.
Concurrent code can come in many different shapes and forms. Depending on what we’re trying to achieve, the abstraction that’ll prove to be the best fit might vary quite a lot from use case to use case. One such abstraction is Tasks, and this week, let’s take a look at some scenarios in which they can become really useful.
Most apps these days need a way to download data from the Internet — whether that’s files, images, or by talking to some form of web API through a format like JSON. Let’s take a look at how to do that using Foundation’s URLSession API.
Grand Central Dispatch is one of the few different options available to us when it comes to asynchronous programming in Swift. Let’s take a look at how it works and how to use it.
Max Howell, creator of Homebrew and PromiseKit, joins John to talk about package manager design, asynchronous programming, interview processes, and also to tell some stories of how the Swift Package Manager was born.
A race condition is what happens when the expected completion order of a sequence of operations becomes unpredictable, causing our program logic to end up in an undefined state. This week, let's take a look at a common scenario that can cause race conditions, possible ways to avoid them - and how we can make our code more robust and predictable in the process.
Asynchronous code is essential to providing a good user experience, but can at times be really tricky to write, debug and especially test. This week, let's explore how we can make our asynchronous tests much simpler, inspired by the async/await programming paradigm.
When starting to work with tests, there's one problem in particular that almost every developer runs into - how to test asynchronous code. While we've touched on this subject before, this week, let's focus in on a few different techniques that can help make testing asynchronous code a lot easier.
Handling asynchronous code in a way that is predictable, readable and easy to debug can be really challenging. This week, let's take a look at a technique that can make managing asynchronous calls a bit simpler and less error prone - using tokens.
Ash Furrow from Artsy joins John to answer questions about being inspired by other languages, asynchronous programming, doing test-driven development and much more.
Let's take a look at Futures and Promises, a really popular abstraction for making asynchronous code easier to manage, by writing an implementation from scratch.
Grand Central Dispatch is one of those fundamental technologies that most Swift developers have used countless times. This week, let’s go beyond async and take a look at some situations where GCD can be really useful, and how it can provide simpler (and more “Swifty”) options to many other Foundation APIs.