// the find
siteline/swiftui-introspect
Introspect underlying UIKit/AppKit components from SwiftUI
SwiftUIIntrospect lets you reach through a SwiftUI view to grab the underlying UIKit or AppKit instance (UIScrollView, UITextField, etc.) so you can tweak things SwiftUI's own modifiers don't expose. It's for iOS/macOS developers who hit the wall of SwiftUI's limited customization API and need direct access without dropping to UIViewRepresentable everywhere.
No private API usage — it walks the view hierarchy with marker views and public APIs only, so it won't get you an App Store rejection. Very wide view type coverage (40+ types including style variants like List.grouped vs List.sidebar). The explicit per-OS-version opt-in (.iOS(.v17, .v18)) is a deliberate design choice that forces you to acknowledge when Apple might have changed the underlying view, rather than silently breaking. Documented extension point (@_spi(Advanced)) for adding your own introspectable types when something's missing.
Fundamentally a heuristic: it infers the underlying view by traversing the hierarchy between two invisible markers, which can find the wrong view or nothing at all if SwiftUI's internal composition shifts — the library just silently no-ops in that case rather than failing loudly, which can hide bugs. The closure can fire multiple times per view lifecycle and you're on the hook for making your customization idempotent; mutating SwiftUI state directly from it is unsafe and requires wrapping in DispatchQueue.main.async, which is an easy footgun. Whole categories of common views (Text, Image, Button on UIKit, all the Stack types, Menu, Divider) simply can't be introspected because they have no backing view — you'll hit this wall eventually. The README states no new features will land, only new OS version support, so any gap you find is yours to patch via the advanced SPI.