David Nadoba

@dnadoba
160 Followers
93 Following
9 Posts
Mac UI Performance @apple, previously Swift on Server
GitHubhttps://github.com/dnadoba

One more reason to like @Observable: It isn't just a SwiftUI feature. You can use it in AppKit and UIKit views too, so the same observation model works across all three frameworks, the same per property tracking everywhere.

Deeper dive in my WWDC26 talk, Use SwiftUI with AppKit and UIKit:
๐Ÿ”— https://developer.apple.com/videos/play/wwdc2026/272/

Use SwiftUI with AppKit and UIKit - WWDC26 - Videos - Apple Developer

Discover how to incrementally adopt SwiftUI in your existing AppKit or UIKit app. We'll show you how to use the Observation framework to...

Apple Developer

We're live! The SwiftUI Group Lab at WWDC26 is starting now, Apple engineers taking SwiftUI questions for the next hour.

Join in:
https://developer.apple.com/videos/play/wwdc2026/8006/

SwiftUI Group Lab - WWDC26 - Videos - Apple Developer

Join us online for a deep dive into WWDC26 with Apple engineers and designers to ask questions, get advice, and follow the discussion...

Apple Developer

Questions are now open! You can submit your SwiftUI questions for today's WWDC26 Group Lab right up until it begins.

Live Q&A with Apple engineers at 9am PT:
https://developer.apple.com/videos/play/wwdc2026/8006/

SwiftUI Group Lab - WWDC26 - Videos - Apple Developer

Join us online for a deep dive into WWDC26 with Apple engineers and designers to ask questions, get advice, and follow the discussion...

Apple Developer

Got a SwiftUI performance question like this? I'm taking them live at the WWDC26 SwiftUI Group Lab. Register now and bring yours.

๐Ÿ“… June 10, 2026 ยท 9:00โ€“10:00 AM PT
๐Ÿ”— https://developer.apple.com/wwdc26/schedule/949P6QKZFA/dashboard

Activity registration - Schedule - WWDC26 - Apple Developer

Sign up for WWDC26 activities.

Apple Developer

SwiftUI perf tip

In lazy containers (List, LazyVStack), the view ForEach produces per element should be a *constant* number of views. An if inside the closure means 1 or 0 views, non-constant, and hits a slow path.

Wrap the condition in a VStack:

ForEach(namedFonts) { namedFont in
VStack {
if namedFont.name.count != 2 {
Text(https://namedFont.name)
}
}
}

or filter your data upfront.

Debug with: -LogForEachSlowPath YES

๐Ÿ”— https://developer.apple.com/documentation/swiftui/foreach

@anosidium that's great to hear!
It's the Lepro TB1. I modified it to run WLED. I tried two ways: a simple one where I just swap in a pre-flashed ESP module (https://www.youtube.com/watch?v=U6JEBI1LDZ8), and one where I soldered wires to the existing ESP32 inside and flashed WLED onto it directly (https://www.youtube.com/watch?v=zNQnIrFs74g).
Both worked great, but soldering was definitely more fun!
will it WLED - Episode 7 (the viral Lepro TB1 orbital lamp)

YouTube
The UI Frameworks team uses this same approach themselves. AppKit controls like NSSlider, NSSwitch, and NSSegmentedControl are now actually implemented in SwiftUI under the hood.

My WWDC26 session is out: Use SwiftUI with AppKit and UIKit ๐Ÿ’ก

I walk through incrementally adopting SwiftUI in an app you already have: using Observation to update your AppKit and UIKit views automatically, embedding SwiftUI into an existing view hierarchy, bringing gesture recognizers across, and adding full SwiftUI scenes without rearchitecting.

๐Ÿ”—https://developer.apple.com/videos/play/wwdc2026/272

Use SwiftUI with AppKit and UIKit - WWDC26 - Videos - Apple Developer

Discover how to incrementally adopt SwiftUI in your existing AppKit or UIKit app. We'll show you how to use the Observation framework to...

Apple Developer

I'm joining the SwiftUI Group Lab at WWDC26 this Wednesday, a live online Q&A with Apple engineers about the week's biggest SwiftUI announcements ๐Ÿงช

You can register now, then submit your SwiftUI questions in the hour before we go live:
๐Ÿ“… June 10, 9โ€“10am PT
https://developer.apple.com/wwdc26/schedule/949P6QKZFA/dashboard

Activity registration - Schedule - WWDC26 - Apple Developer

Sign up for WWDC26 activities.

Apple Developer