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 […]
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, […]
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 […]
Every year, Apple’s platforms keep progressing at a quite rapid pace, but very often, we also need our apps to support older versions of the various operating systems that they run on. So the challenge then becomes — how to adopt new system APIs and features without sacrificing our overall backward compatibility? That’s where availability […]
For all of its strengths and overall convenience, one downside of Swift’s built-in Codable API is that it doesn’t really offer any standard way to change or otherwise customize how a given type should be encoded or decoded. While we can always write completely custom coding implementations for the types that we’ve defined ourselves, when […]
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 […]
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 […]
Recently, I’ve been more and more curious about web experience through mobile apps. Most of web browser apps look alike, I was wondering how could I recreate one with WebKit and SwiftUI. Let’s dive in. First Web View If you’re familiar with UIKit, since Apple deprecated UIWebView, there is only one way to support a […]
One challenge when it comes to concurrency on Apple’s platforms is that an app’s UI can, for the most part, only be updated on the main thread. So, whenever we’re performing any kind of work on a background thread (either directly or indirectly), then we always have to make sure to jump back to the […]
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 […]