• Codable synthesis for Swift enums

    One of the major advantages of Swift’s built-in Codable API is how the compiler is able to automatically synthesize many different encoding and decoding implementations when using it. In many cases, all that we have to do to enable a Swift type to be serialized into formats like JSON is to mark it as Codable,…

    Read More

  • New Discover page: Codable

    Discover Swift’s Codable protocol, how to fully leverage its compiler synthesis features, and how to use its surrounding APIs to write efficient serialization code. → Check it out

    Read More

  • 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