Quantcast
Channel: Swift by Sundell
Browsing all 100 articles
Browse latest View live

What role do Tasks play within Swift’s concurrency system?

When writing asynchronous code using Swift’s new built-in concurrency system, creating a Task gives us access to a new asynchronous context, in which we’re free to call async-marked APIs, and to...

View Article


Podcast: “Concurrency beyond app development”, with special guest Tim Condon

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...

View Article


Lightweight dependency injection and unit testing using async functions

Very often, making code easy to unit test tends to go hand-in-hand with improving that code’s separation of concerns, its state management, and its overall architecture. In general, the more...

View Article

Delaying an asynchronous Swift Task

Most often, we want our various asynchronous tasks to start as soon as possible after they’ve been created, but sometimes we might want to add a slight delay to their execution — perhaps in order to...

View Article

New Discover page: Concurrency

Explore Swift’s built-in concurrency system, and how to use tools like async/await and actors to write concurrent code in robust and efficient ways.→ Check it out

View Article


Podcast: “Custom rendering”, with special guest James Thomson

James Thomson returns to the show to discuss the various technologies that enable us to render custom UIs on Apple’s platforms. From rendering views using Core Graphics and Core Animation, to building...

View Article

Building an asynchronous SwiftUI button

When building modern applications, it’s incredibly common to want to trigger some form of asynchronous action in response to a UI event. For example, within the following SwiftUI-based PhotoView, we’re...

View Article

Podcast: “The 2021 Season Finale”

To wrap up the 2021 season of the show, John revisits some of the key themes and topics that were discussed both on the show itself, and within the Swift community in general, throughout the...

View Article


Two ways of capturing self strongly within a closure

In Swift, there are two ways to capture self as a strong reference within an escaping closure. The first is to explicitly use the self keyword whenever we’re calling a method or accessing a property on...

View Article


Creating Combine-compatible versions of async/await-based APIs

A challenge that many developers face as they maintain various code bases over time is how to neatly connect different frameworks and APIs in a way that properly adheres to the conventions of each...

View Article

Basics: Loops

Swift offers many different built-in ways to iterate over collections (such as arrays, sets, and dictionaries) — the most basic of which being for loops, which let us run a piece of code for each...

View Article

Backgrounds and overlays in SwiftUI

SwiftUI offers several different ways for us to create stacks of overlapping views that can be arranged along the Z axis, which in turn enables us to define various kinds of overlays and backgrounds...

View Article

Automatically retrying an asynchronous Swift Task

Sometimes, we might want to automatically retry an asynchronous operation that failed, for example in order to work around temporary network problems, or to re-establish some form of connection.Here...

View Article


Memory management when using async/await in Swift

Managing an app’s memory is something that tends to be especially tricky to do within the context of asynchronous code, as various objects and values often need to be captured and retained over time in...

View Article

Combining protocols in Swift

One of the core strengths of Swift’s protocols is that they enable us to define shared interfaces that multiple types can conform to, which in turn lets us interact with those types in a very uniform...

View Article


Writing testable code when using SwiftUI

A major part of the challenge of architecting UI-focused code bases tends to come down to deciding where to draw the line between the code that needs to interact with the platform’s various UI...

View Article

Podcast: “Where is Swift headed in 2022?”, with special guest JP Simard

On this 2022 season premiere, JP Simard returns to the show to discuss what’s next for Swift in 2022, and what kinds of improvements and new features that might be coming to the language during the...

View Article


Basics: Equality

Checking whether two objects or values are considered equal is definitely one of the most commonly performed operations in all of programming. So, in this article, let’s take a look at how Swift models...

View Article

Image may be NSFW.
Clik here to view.

Sponsor: Judo

My thanks to Judo for sponsoring Swift by Sundell — both the website and the podcast — during this first quarter of the year. Those of you who have been following my work for a while might know that...

View Article

Abstract types and methods in Swift

In object-oriented programming, an abstract type provides a base implementation that other types can inherit from in order to gain access to some kind of shared, common functionality. What separates...

View Article
Browsing all 100 articles
Browse latest View live