• 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 abstract types from regular ones is that they’re never meant to be used as-is (in fact, some programming languages even prevent abstract types from being…

    Read More

  • Podcast: “Accessibility on Apple’s platforms”, with special guest Sommer Panage

    Sommer Panage returns to the show to discuss Apple’s various accessibility APIs and tools, how to incorporate accessibility support into a team’s overall development workflow, and what it was like being an engineering manager at Apple. Sponsors Emerge Tools: Optimize your app’s startup time, binary size, and overall performance using Emerge’s advanced app optimization and…

    Read More

  • Type placeholders in Swift

    Swift’s type inference capabilities have been a very core part of the language since the very beginning, and heavily reduces the need for us to manually specify types when declaring variables and properties that have default values. For example, the expression var number = 7 doesn’t need to include any type annotations, since the compiler…

    Read More

  • 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 technology involved. For example, as teams around the world are starting to adopt Swift 5.5’s async/await-powered concurrency system, we’ll likely find…

    Read More

  • 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 element that was found within a given collection. For example, here we’re looping through an array of names, and we’re…

    Read More

  • 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 for the views that we build. Let’s explore some of those built-in stacking methods and what sort of UIs that they…

    Read More

  • 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 we’re doing just that when using Apple’s Combine framework to implement a network call, which we’ll retry up to 3 times before handling any error…

    Read More

  • 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 order for our asynchronous calls to be performed and handled. While Swift’s relatively new async/await syntax does make many kinds…

    Read More

  • 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 way, without necessarily knowing what underlying type that we’re currently dealing with. For example, to clearly define an API…

    Read More

  • 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 the current object within such a closure. For example, the following VideoViewController performs such a strong capture in order…

    Read More