iPX Directory

Directory Technology

Swift by Sundell

Listed, no subscribers yet

Paste it into any podcast app or feed reader to subscribe.

Weekly Swift articles, podcasts and tips by John Sundell

Latest posts

Using Swift’s ‘some’ keyword beyond SwiftUI

How the ‘some’ keyword can be used to create clean APIs and abstractions when using generics, even outside the realm of SwiftUI. Developers who have worked with Apple’s SwiftUI framework have likely encountered the some keyword in the context of defining custom views, where it’s typically used to enable the generic View protocol to be referenced as a type when declaring a view’s body : struct Cont

30 Sep 2026
Why Swift is introducing a warning for weak captures within nested closures

Let’s take a look at a new Swift diagnostic which helps prevent memory issues with implicit self captures when nested closures are used. New in Swift 6.4 (which at the time of writing is in beta as part of Xcode 27) is a warning which is emitted when a nested closure performs a weak capture while the parent closure implicitly captures that object as a strong reference . At first glance, that new d

30 Aug 2026
Swift protocols and the main actor

How the main actor relates to Swift protocols, and what the practical differences are between isolating an entire protocol to the main actor, versus only marking specific requirements as isolated. In Swift, the @MainActor attribute can be used to associate a given type, function, or value with the global main actor , which essentially makes any such code operate on the enclosing app’s main thread.

31 Jul 2026
Building a design system at Genius Scan

An example of how to approach the task of building a design system for an app, by focusing on creating an initial set of reusable components that can be tweaked using the SwiftUI environment. As an app’s code base grows and evolves, it can be really tricky to maintain consistency within its UI. It’s easy for things like margins and padding, or colors and fonts, to start diverging, as different dev

31 Aug 2025
Deciding between ‘let’ and ‘var’ for Swift struct properties

Does marking a given Swift struct property as either ‘let’ or ‘var’ simply determine its mutability, or is there more to it? Let’s explore! When declaring a Swift property, we use either the let or var keyword depending on whether we want our new property to be read-only once assigned through the enclosing type’s initializer, or whether we want to allow the property to be mutated and re-assigned m

23 Jul 2025
Decoding Swift types that require additional data

How Swift’s CodableWithConfiguration API can be used to inject additional, required data into a type’s decoding process, without having to use optionals or declare any additional decoding-specific types. Swift’s Codable API — which consists of the Encodable protocol for encoding, and Decodable for decoding — offers a powerful, built-in mechanism for converting native Swift types to and from a seri

30 Jun 2025
Tips and tricks for when using SwiftUI’s ViewBuilder

Let’s explore how we can use SwiftUI’s ViewBuilder within our own code, and a few things that can be good to keep in mind when doing so. SwiftUI’s ViewBuilder type is a key part of the library’s overall API design, in that it’s what enables multiple view expressions to be declared within a given scope (such as a body property implementation, or a closure passed to containers such as HStack or VSta

30 May 2025
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. Swift’s defer keyword allows us to delay the execution of a given block of code until the current scope is exited. While that might initially not seem that useful (after all, can’t we simply write that code at the end of the scope instead?), it turns

15 Apr 2025
Modern URL construction in Swift

How to combine Foundation’s latest URL APIs with Swift features like macros, to be able to work with both static and dynamic URLs in simpler and more predictable ways. These days, most applications need to work with URLs in some form. Perhaps they’re used to make network calls, to read and write files, or to perform various kinds of database operations. In Swift, URLs are by convention (and throug

31 Mar 2025
Swift by Sundell is back!

After a two-year hiatus, Swift by Sundell is finally back, with new articles published on a regular basis. I never actually decided to stop writing Swift articles. It just sort of happened . In fact, for the past two years as this website has been very much dormant, I’ve lost count of the number of times that I’ve sat down at my desk with the intent to write and publish a new article, or the numbe

31 Mar 2025
SwiftUI views versus modifiers

What’s really the difference between building a piece of UI as a view versus a modifier, and how to choose between those two solutions? One of the most interesting aspects of SwiftUI, at least from an architectural perspective, is how it essentially treats views as data. After all, a SwiftUI view isn’t a direct representation of the pixels that are being rendered on the screen, but rather a descri

27 Feb 2023
Observing the content offset of a SwiftUI ScrollView

How the content offset of a SwiftUI ScrollView can be observed without bridging to UIKit. When building various kinds of scrollable UIs, it’s very common to want to observe the current scroll position (or content offset , as UIScrollView calls it) in order to trigger layout changes, load additional data when needed, or to perform other kinds of actions depending on what content that the user is cu

30 Jan 2023
Podcast: “The evolution of Swift”, with special guest Nick Lockwood

On this final episode of 2022, Nick Lockwood returns to the show to discuss the overall evolution of Swift and its ecosystem of tools and libraries. How has Swift changed since its original introduction in 2014, how does it compare to other modern programming languages, and how might the language continue to evolve in 2023 and beyond? Sponsors Bitrise : Rock-solid continuous integration for your S

19 Dec 2022
Podcast: “Swift concurrency in practice”, with special guest Ben Scheirman

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. Sponsors Essential Developer : Join the iOS Architect Crash Course to accelerate your journey towards becoming a senior developer. It’s 100% free and held entirely online. NordVPN : Get an exclusive discount on Nord

18 Nov 2022
Combining opaque return types with primary associated types

How Swift’s opaque return types can be combined with primary associated types in order to create powerful abstractions without the need for any type erasure. Ever since Swift was first introduced, it’s been very common to need to use type erasure when working with generic protocols — ones that either reference Self within their requirements, or make use of associated types. For example, in earlier

12 Nov 2022
Podcast: “Responsive and smooth UIs”, with special guest Adam Bell

Adam Bell returns to the podcast to discuss different techniques and approaches for optimizing UI code, and how to utilize tools like animations in order to build iOS apps that feel fast and responsive. Sponsors NordVPN : Get an exclusive discount on NordVPN’s excellent VPN service, by going to nordvpn.com/sundell . They even have a 30-day money-back guarantee. Bitrise : Rock-solid continuous inte

31 Oct 2022
Podcast: “Freelancing and WWDC22 highlights”, with special guest Donny Wals

Donny Wals returns to the show to talk about being an iOS developer freelancer, and to discuss some of the key new APIs, Swift language features, and frameworks that were introduced at WWDC22. Sponsors Essential Developer : Join the iOS Architect Crash Course to accelerate your journey towards becoming a senior developer. It’s 100% free and held entirely online. Bitrise : Rock-solid continuous int

17 Sep 2022
Podcast: “The role of system design”, with special guest Gui Rambo

Gui Rambo returns to the show to talk about the role and importance of system design when building apps and open source tools, and how common app architectures and design patterns can be augmented with custom systems. Sponsors NordVPN : Get an exclusive discount on NordVPN’s excellent VPN service, by going to nordvpn.com/sundell . They even have a 30-day money-back guarantee. Bitrise : Rock-solid

31 Aug 2022
Sponsored: Essential Developer

Thanks a lot to Essential Developer for sponsoring Swift by Sundell. Thanks a lot to Caio and Mike, the two developers behind Essential Developer , for sponsoring Swift by Sundell. Essential Developer was founded to help iOS developers accelerate their journeys towards becoming complete senior developers, and on July 18th, Caio and Mike will kick off the next edition of their iOS Architect Crash C

13 Jul 2022
Podcast: “What’s new in SwiftUI in iOS 16?”, with special guest Natalia Panferova

Natalia Panferova joins John to discuss some of the key new features that are coming to SwiftUI and UIKit in iOS 16, and to talk about her experience working on SwiftUI at Apple. Sponsors NordVPN : Get an exclusive discount on NordVPN’s excellent VPN service, by going to nordvpn.com/sundell . They even have a 30-day money-back guarantee. Essential Developer : Join the iOS Architect Crash Course to

11 Jul 2022