55 Followers
19 Following
31 Posts
A Swift Programmer
Also worth noting — OpenSwiftUI provides this API too. If you're using OpenSwiftUI, you can use CAHostingLayer directly via _spi import OpenSwiftUI without the extra swiftinterface workaround.
See #831 and #832 for more detail.
SwiftUI has a hidden CAHostingLayer API — host your SwiftUI views directly in a CALayer.
Currently used internally by UIKit/AppKit and WebKit. Available since iOS 18 / macOS 15.
I wrote a guide on how to access it without Apple's internal SDK 👇
https://gist.github.com/Kyle-Ye/8a7f12487a4ce2ca6ac9e087b09d4a20
Debugging NSUserActivity in SwiftUI can be painful—failures are silent and timing is unpredictable.
There's a hidden flag that helps: _defaultSwiftUIActivityEnvironmentLoggingEnabled
See more info on https://kyleye.top/tips/swiftui-useractivity-debug-logging/ #SwiftUI
Debug NSUserActivity in SwiftUI with Hidden Logging Flag | 知阅百微 见微知著

Enable _defaultSwiftUIActivityEnvironmentLoggingEnabled to debug Handoff, Spotlight, and userActivity issues

知阅百微 见微知著
Spend some time last week on the new DebugReplaceableView and how they work together with the old AnyView.
See https://kyleye.top/posts/debugreplaceableview-multiple-type-erasers
DebugReplaceableView and Swift 6.2's Multiple Type Erasers | 知阅百微 见微知著

How Swift 6.2 enabled multiple @_typeEraser attributes for SwiftUI's new debug optimization

知阅百微 见微知著

Swift 6.2 now supports multiple @_typeEraser attributes, enabling SwiftUI's new DebugReplaceableView for faster Xcode Previews on iOS 26+.
Here's how it works under the hood.

https://kyleye.top/posts/debugreplaceableview-multiple-type-erasers/

DebugReplaceableView and Swift 6.2's Multiple Type Erasers | 知阅百微 见微知著

How Swift 6.2 enabled multiple @_typeEraser attributes for SwiftUI's new debug optimization

知阅百微 见微知著

New blog post is out:
Debugging SwiftUI with AttributeGraph: From DisplayList to Transactions

In-depth analysis of debugging SwiftUI using AttributeGraph API

Read here:
https://kyleye.top/posts/swiftui-debug-analysis/?lang=en

From: @KyleYe
https://mastodon.world/@KyleYe/115057062767971478

从 DisplayList 到 Transaction: SwiftUI 调试实战 | 知阅百微 见微知著

深入分析如何使用 AttributeGraph API 调试 SwiftUI

知阅百微 见微知著
Here’s a sneak peek at the TOC I’m drafting for the article 👇
Anyone interested in how to quickly dive into and debug the internals of SwiftUI?
I’m planning to publish an article later this month about how I debug and fixed this issue
https://github.com/OpenSwiftUIProject/OpenSwiftUI/issues/461
Stay tuned—and let me know in the comments which parts you’d be most curious about!
@PetterOfCats It’s about the secret behind SwiftUI. Not about showing “Hello World” stuff.

Note: all the information is subject to change without notice.

Please do not use this in production environment. Only use it as a debug tool for inspecting SwiftUI internal Bug.