• Using 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 at how the share operator can enable us to do that in a really neat way. Duplicate, concurrent network calls As an…

    Read More

  • Previewing 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 landscape by creating two instances of our view within its PreviewProvider: struct MenuView_Previews: PreviewProvider { static var previews: some View { MenuView() MenuView().previewInterfaceOrientation(.landscapeRight) } } Note…

    Read More

  • Podcast: “Building various kinds of editors”, with special guest Marcin Krzyzanowski

    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 of composition, and managing hobby projects. Sponsors RevenueCat: In-app subscriptions made easy. RevenueCat handles the pain points of implementing subscriptions and in-app purchases, so…

    Read More

  • Programmatic 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 and tab switching. However, sometimes we might want to take more direct control over how an app’s navigation is performed, and although…

    Read More

  • Podcast: “The magic of Augmented Reality”, with special guest Roxana Jula

    Roxana Jula joins John to discuss Apple’s various tools, frameworks, and APIs for building Augmented Reality experiences. How to get started building AR-based apps, what’s the current state of AR on Apple’s platforms, and how might that change if Apple were to introduce dedicated AR hardware in the future? Sponsors Stream: Build scalable in-app chat…

    Read More

  • Conditional compilation within Swift expressions

    New in Swift 5.5: It’s now possible to conditionally compile postfix member expressions using Swift’s #if compiler directive. Let’s take a look at what kinds of situations that this new feature could be really useful in. Working around platform differences Although many of the built-in APIs and frameworks work exactly the same way across Apple’s…

    Read More

  • Defining dynamic colors in Swift

    For the most part, it’s fair to say that modern iOS and Mac apps are expected to gracefully adapt to whether the user’s device is running in light or dark mode, which often requires us to use more dynamic colors within the UIs that we build. While Apple does make it fairly straightforward to declare…

    Read More

  • Using static protocol APIs to create conforming instances

    New in Swift 5.5: It’s now possible to define protocol APIs that let us use Swift’s very convenient “dot syntax” to create conforming instances, which in turn can make certain protocols act more like enums, while still retaining all of the flexibility that protocols give us. For example, when applying a style to a SwiftUI…

    Read More

  • Podcast: “What’s new in Swift 5.5”, with special guest Antoine van der Lee

    Antoine van der Lee, creator of SwiftLee, joins John to discuss the new language features that are being introduced as part of Swift 5.5 — from the brand new concurrency system, to convenience features and various improvements. Sponsors Stream: Build scalable in-app chat or activity feeds in record time using Stream’s open source, Swift-native SDK…

    Read More

  • Async sequences, streams, and Combine

    When iterating over any Swift collection using a standard for loop, there are two key components that decide what elements that will be passed into our iteration code — a sequence, and an iterator. For example, Swift’s standard Array type is a sequence, and uses IndexingIterator as its iterator type. While we very often interact…

    Read More