Quantcast
Channel: Swift by Sundell
Browsing all 100 articles
Browse latest View live

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...

View Article


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...

View Article


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...

View Article

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...

View Article

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...

View Article


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...

View Article

Stroking and filling a SwiftUI shape at the same time

One really powerful aspect of SwiftUI’s overall API is that it enables us to draw things like shapes, gradients, and colors the same way that we render views and UI controls. For example, if we wanted...

View Article

Podcast: “Cross-platform SwiftUI”, with special guest Malin Sundberg

Malin Sundberg joins John to talk about her experiences of using SwiftUI to build and ship the time-tracking and invoicing app Orbit on most of Apple’s platforms, and what sort of things that can be...

View Article


Attaching property wrappers to function arguments

New in Swift 5.5: Property wrappers can now be applied directly to function arguments, just like how they can be used to add additional functionality to a property or local variable.For example, let’s...

View Article


Throwing and asynchronous Swift properties

Swift 5.5 introduces a new concept called “effectful read-only properties”, which essentially means that computed properties can now utilize control flow mechanisms like errors and async operations...

View Article

Podcast: “WWDC21, two months later”, with special guest Jordan Morgan

Jordan Morgan returns to the show to discuss some of the key new APIs and frameworks that were announced at WWDC21, and how they can be integrated into the apps that we build, now that about two months...

View Article

Using ‘@unknown default’ within switch statements

When switching on an enum, we are required to either explicitly handle all of its cases, or provide a default case that’ll act as a fallback for cases that weren’t matched by any previous case...

View Article

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...

View Article


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...

View Article

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...

View Article


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...

View Article

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...

View Article


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...

View Article

Sponsor: Paste

My thanks to the team behind the clipboard management app Paste for sponsoring Swift by Sundell last week, and for helping me continue to keep the site completely free to access for everyone.Paste is...

View Article

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,...

View Article
Browsing all 100 articles
Browse latest View live