SwiftUI Introspect is a library that lets you access the underlying UIKit or AppKit view for a SwiftUI view.
SwiftUI provides a declarative interface that abstracts away the underlying platform views, but sometimes you need direct access to UIKit or AppKit components to apply customizations or behaviors that SwiftUI does not expose. SwiftUI Introspect solves this by adding invisible marker views above and below your target SwiftUI view, then traversing the view hierarchy between those markers to locate the corresponding UIKit or AppKit instance. Once found, you can customize that underlying view directly through a closure.
The tool is suitable for production use because it relies only on public APIs and takes a defensive approach: it makes no hard assumptions about layout, performs no forced type casts, and gracefully ignores introspection requests when the expected underlying view cannot be found. You should adopt it when you need to bridge SwiftUI's declarative model with platform-specific customizations that have no SwiftUI equivalent. The library supports a range of view types and allows you to introspect either the direct receiver or an ancestor view by setting the scope parameter. Future OS releases require explicit opt-in through version markers because underlying UIKit and AppKit types can change between major versions.
The project maintains a straightforward approach to development, with clear documentation of how introspection works and explicit guidance on when and how to use it safely. The README emphasizes that instances should be kept outside the customize closure to avoid unintended side effects, and it provides guidelines for library authors considering whether to depend on this tool. The project includes examples and supports implementing custom introspectable types for views not yet covered by the built-in support.