SwiftUI views versus modifiers
What’s really the difference between building a piece of UI as a view versus a modifier, and how to choose between those two solutions?
Articles, podcasts and news about Swift development, by John Sundell.
What’s really the difference between building a piece of UI as a view versus a modifier, and how to choose between those two solutions?
How the content offset of a SwiftUI ScrollView can be observed without bridging to UIKit.
Natalia Panferova joins John to discuss some of the key new features that are coming to SwiftUI and UIKit in iOS 16, and to talk about her experience working on SwiftUI at Apple.
Different ways to implement a dynamic SwiftUI stack that renders its content either horizontally or vertically, depending on the current context.
Exploring how iOS 16’s new UIHostingConfiguration API enables us to inline SwiftUI views within our UITableView or UICollectionView cells.
Chris Eidhof returns to the podcast to talk about how SwiftUI has evolved since its initial release, to share several key learnings from using it over the past few years, and to discuss concepts like app architecture and state management.
Let’s take a look at how we can make our UI-related logic fully testable, even when that logic is primarily used within SwiftUI-based views.
How SwiftUI enables us to stack views along the Z axis, which in turn makes it possible to create all sorts of backgrounds, overlays, and other effects.
How a custom SwiftUI button that’s capable of running asynchronous actions can be created, and how to make such a control versatile and easy to reuse across a project.
Ben Scheirman returns to the show to talk about modern UIKit-based app development, how UIKit has evolved over the past few years, and how its API design and usage has been influenced by the introduction of frameworks like SwiftUI and Combine.
How SwiftUI’s List and ForEach types can be used to build lists that support inline editing, moving, and deletions, and how we can then build our own abstractions on top of those built-in types.
Let’s take a look at which of the new SwiftUI APIs that are backward compatible with earlier OS versions, and what language features that made that possible.
How we can take direct control over SwiftUI’s navigation system, which enables us to dynamically show and hide views within either a TabView or NavigationView.
How to preview a SwiftUI view in landscape using Xcode 13, and how to enable that new feature to be used within projects that also support previous iOS versions.
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?
Various techniques that let us define fully dynamic colors that adapt to the user’s selected color scheme, using either SwiftUI or UIKit.
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 have passed since the conference took place.
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 good to keep in mind when using SwiftUI in a cross-platform context.
How to compose multiple SwiftUI views to render a shape that’s both stroked and filled at the same time.
Three different ways to dismiss a SwiftUI view that was presented from another view, including a new API that’s being introduced in iOS 15.
A look at how SwiftUI’s new refreshable modifier can be used to either add pull-to-refresh to a list, or to build completely custom reloading UIs and logic.
Sean Allen returns to the show to talk about using the MVVM design pattern within SwiftUI-based apps, building a course around MapKit and CloudKit, how to approach all of the new material that WWDC has to offer, and what goes into making a really great developer portfolio.
When using multiple computed properties within SwiftUI views could become problematic, and various approaches to fix those kinds of problems.
How the frame modifier can be used to create resizable views that fill the container they’re rendered in.
Benedikt Terhechte returns to the show to discuss the pros and cons of using technologies like Catalyst and SwiftUI to build Mac apps, and also to share tips and tricks on how to use AppKit for use cases that Apple’s more modern frameworks do not yet support.
Setting up two-way bindings between the elements in a collection and a series of SwiftUI views.
David Smith, creator of apps like Widgetsmith, returns to the show to discuss whether SwiftUI is currently capable and stable enough to build production-level apps, and what sort of things that can be good to keep in mind when starting to deploy SwiftUI in production.
Matt Gallagher, creator of Cocoa with Love, returns to the show to discuss how the introduction of SwiftUI and Combine has impacted how apps are architected on Apple’s platforms, and what sort of principles that are good to keep in mind when designing a solid app architecture.
How to round the corners of a UIKit or SwiftUI view in various ways.
How SwiftUI’s AnyView type can often be avoided, and why it might be a good idea to do so.
How a SwiftUI view’s body can be split up into multiple computed properties, which is a great alternative to using separate types in certain situations.
A look at what it means for SwiftUI to be a value-driven UI framework, and how we might need to break certain assumptions when adopting SwiftUI within our projects.
Chris Eidhof returns to the show to go on a deep dive into the SwiftUI layout system. What are the different phases involved in determining a given view’s layout, how do concepts like layout priorities and flexibility work, and what makes SwiftUI different from UIKit and AppKit in terms of layout?
In this second article about integrating SwiftUI and UIKit, we’ll take a look at how SwiftUI views can be embedded within UIKit-based view controllers, and various ways of sharing state between them.
A closer look at how SwiftUI and UIKit can be combined in various ways, starting with how we can bring increasingly complex UIKit-based views and view controllers into the declarative world of SwiftUI.
James Thomson, creator of PCalc, returns to the show to discuss how developers can bring their apps to multiple Apple platforms using technologies like Catalyst and SwiftUI, and how and when it can be a good idea to share code across platforms.
A few different patterns and approaches that can be used to handle and render asynchronous loading states within SwiftUI-based views.
Simon Støvring, the developer behind several powerful iOS productivity apps, including Scriptable, joins John on an episode all about the new home screen widgets introduced in iOS 14. Topics include how to create and update dynamic widgets, managing and sharing data between an app and its widgets, and much more.
An overview of the tools and techniques that we can use to create a clean separation between our view hierarchy, its styles, and the components that we’re looking to reuse across a given project.
Jordan Singer joins John to discuss various approaches of turning designs into fully implemented UIs, how to manage things like mock data during the development process, and when to turn a given view into a reusable component. Also, the story behind the Airport app and Jordan’s recent SwiftUI experiments.
A roundup of some of the key ways in which Swift 5.3 enhances the overall experience of building views using SwiftUI.
This week, let’s take a look at a few examples of building custom debugging utilities for SwiftUI-based views — from specific methods to general-purpose abstractions.
A closer look at Swift’s result builders feature, and how it can give us some really valuable insights into how SwiftUI’s DSL operates under the hood.
Tips on how to texture SwiftUI views using tiling images, and how to ensure that such views are rendered in a smooth and predictable manner.
Let’s take a closer look at opaque return types, how they can be used both with and without SwiftUI, and how they compare to similar generic programming techniques, such as type erasure.
This week, let’s take a closer look at each of SwiftUI’s state handling property wrappers, how they relate to each other, and how they make up different parts of SwiftUI’s overall state management system.
Josh Shaffer and Eliza Block from Apple join John to talk about what’s new in SwiftUI, how Xcode Previews work under the hood, the new home screen widget system, Apple’s internal process of adopting and improving SwiftUI, and much more.
Let’s take a look at one possible venue for learning and exploring SwiftUI without having to necessarily deploy it directly into production — by building internal tools and various prototypes.
Let’s take a look at a number of techniques, patterns, and ways of structuring UI code that can help us get the very most out of Xcode’s SwiftUI-powered preview system.
This week, let’s take a look at a few techniques that can help us make our code easier to read, test and maintain, by reducing the amount of indentation within it.
Let’s take a look at a few techniques that can make it much simpler to propagate runtime errors to our users, and how employing some of those techniques could help us present richer error messages without having to add a ton of complexity within each UI implementation.
Tobias Due Munk joins John to talk about using SwiftUI to build prototypes, how third party developers can extend SwiftUI’s built-in APIs in various ways, and to discuss the challenges of writing highly dynamic systems in Swift.
This week, we’ll wrap up the SwiftUI layout system series by taking a look at how we can customize the layout behaviors of our views, using tools like layout priorities and alignment guides.
A summary of all Swift by Sundell content published during March 2020.
Let’s continue exploring the SwiftUI layout system by taking a look at a couple of more advanced techniques, such as how we can align views with dynamic dimensions and how to read a view’s geometry in order to build custom layouts.
Let’s take a look at the SwiftUI layout system by starting to build a full-screen view from scratch. Along the way, we’ll use many different techniques and APIs, which lets us explore the underlying rules of the SwiftUI layout system.
This week, let’s explore the topic of UI modularization in the context of SwiftUI, by taking a look at a few different techniques that can be useful in order to avoid trading Massive View Controllers for Massive Views.
A summary of all Swift by Sundell content published during February 2020.
Let’s take a look at how SwiftUI’s various stacks and spacers can be used to achieve many kinds of flexible, adaptive layouts with very little code. While SwiftUI does include several more advanced layout APIs, stacks and spacers are a great starting point for most UIs.
This week, let’s take a look at a few different ways of configuring views when using SwiftUI, and the sort of pros and cons that each of those approaches gives us in terms of code structure and flexibility.
Meng To, founder of Design+Code, joins John to go on a deep dive into SwiftUI from a design perspective, and to talk about how developers and designers can build scalable and flexible UIs using it. Also, structuring view code and components, the power of modifiers, and how SwiftUI compares to other UI tools and platforms.
Indie iOS and watchOS developer “Underscore” David Smith joins John to discuss the current state of Apple Watch app development, and how SwiftUI is changing how watchOS apps are built. Also, managing and prioritizing multiple projects, Swift vs Objective-C, and whether SwiftUI is actually production-ready.
Josh Shaffer, engineering director with the UIKit and SwiftUI team at Apple, joins John to go on a deep dive into SwiftUI. What inspired the creation and design of SwiftUI, how does it impact the way apps are developed and architected, how is Apple using and improving SwiftUI internally, and much more.
Adam Bell joins John to talk about audio programming in Swift, and how SwiftUI makes rendering visual representations of audio and other custom shapes easier than ever before. Also, reverse engineering, mixing SwiftUI with UIKit and other view frameworks, and much more.
A recap of the basics of SwiftUI, Apple’s declarative new UI framework for building apps across all of their platforms. How to build custom views and modify existing ones, how to manage local state within a view, and how to compose multiple views to form new ones.
Longtime Apple platforms developer Brent Simmons joins John to discuss how SwiftUI is ushering in a new era for Apple’s developer tools, and how we as third party developers can prepare for it. Also, Mac development, lots of tips for writing efficient code, and dynamic programming in Swift.
Deploying generics in a more gentle fashion — to make a code base simpler, not more complicated.
Kaya Thomas joins John to talk about Apple’s various accessibility technologies and how SwiftUI is taking things to a whole new level. Also, how UI testing and accessibility are closely related, and what makes declarative UI development so powerful.
This week, let’s take a look at a few techniques that we can use to prepare ourselves for undergoing major paradigm shifts when it comes to the APIs and technologies that we use to build apps — using the shift from imperative UI development with UIKit to the declarative nature of SwiftUI as an example.
SwiftUI brings a new, declarative way to build UIs for Apple’s platforms, and also pushes the Swift language itself to new limits — by making heavy use of a set of key new syntax features, that are being introduced as part of Swift 5.1, in order to provide a very DSL-like API. This week, let’s take a first look at those features and how they work.
It’s time for the 2019 Swift by Sundell WWDC special, featuring PCalc creator James Thomson — who, with his over 25 years of experience developing apps for Apple’s platforms, joins John to discuss SwiftUI, Catalyst, and the other exciting tools and frameworks introduced at this year’s WWDC.