• Making SwiftUI views refreshable

    At WWDC21, Apple introduced a new SwiftUI API that enables us to attach refresh actions to any view, which in turn now gives us native support for the very popular pull-to-refresh mechanism. Let’s take a look at how this new API works, and how it also enables us to build completely custom refreshing logic as…

    Read More

  • Calling async functions within a Combine pipeline

    When starting to adopt Swift’s new async/await feature, we’re likely going to have to find ways to connect and bridge that pattern to any existing asynchronous code that we’ve already written within a given project. Earlier this week, we took a look at how that can be done when it comes to completion handler-based APIs,…

    Read More

  • Dismissing a SwiftUI modal or detail view

    When building iOS and Mac apps, it’s very common to want to present certain views either modally, or by pushing them onto the current navigation stack. For example, here we’re presenting a MessageDetailView as a modal, using SwiftUI’s built-in sheet modifier in combination with a local @State property that keeps track of whether the detail…

    Read More

  • Podcast: “A tower of capabilities”, with special guest Chris Lattner

    Chris Lattner returns to the show to discuss Swift’s new concurrency features, the ongoing evolution of the language, and the importance of both language and API design. This, and much more, on this special 100th episode of the show. Sponsor Bitrise: Rock-solid continuous integration for your Swift project, which now offers 50% faster builds and…

    Read More

  • Sponsor: ViRE

    Thanks a lot to the team behind the visual regular expressions editor ViRE for sponsoring Swift by Sundell over the past two weeks, enabling me to keep delivering a continuous stream of Swift articles completely for free. I’ll be honest, I’ve never been a huge fan of working with regular expressions as raw strings. I…

    Read More

  • Mutating and non-mutating Swift contexts

    One of the ways in which Swift helps us write more robust code is through its concept of value types, which limit the way that state can be shared across API boundaries. That’s because, when using value types, all mutations are (by default) only performed to local copies of the values that we’re working with,…

    Read More

  • Podcast: “Structured concurrency”, with special guest Doug Gregor

    Doug Gregor from Apple joins John to discuss Swift 5.5’s new concurrency features in great detail. How do features like async/await and actors work under the hood, and how were those concepts adapted in order to feel right at home within Swift’s existing ecosystem? That, and much more, on this WWDC21 special episode of the…

    Read More

  • Automatic conversions between Double and CGFloat values in Swift 5.5

    New in Swift 5.5: The compiler can now automatically perform conversions between Double and CGFloat values. Although the two have always been equivalent on 64-bit systems, before Swift 5.5 (which is currently in beta as part of Xcode 13), we had to manually convert between them in order to satisfy Swift’s type system — since…

    Read More

  • Connecting async/await to other Swift code

    Swift 5.5’s new suite of concurrency features definitely played a major role at this year’s edition of WWDC. Particularly, the newly introduced async/await pattern could not just be seen in the more Swift-focused sessions and announcements, but all over the new APIs and features that were unveiled at the conference. While async/await is very likely…

    Read More