# nalexn/ViewInspector

Runtime introspection and unit testing of SwiftUI views

Repository: https://github.com/nalexn/ViewInspector
Canonical: https://ross.abutalabs.com/products/viewinspector
Language: Swift
License: MIT
License Family: permissive
Topics: swiftui, swiftui-views, unit-testing, runtime-typechecking, best-practices, swift, swift5
Last push: 2026-08-22T13:04:54+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 24, longevity 100
- inputs: {"age_days": 2482, "days_push": 11, "days_rel": 346, "gap_med": 111, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2629, forks 193 (observed 2026-08-28T04:07:05.530816+00:00)

## What it is
A Swift library for unit testing SwiftUI views by traversing the view hierarchy at runtime and exposing the underlying view structs. It uses official Swift reflection APIs to inspect standard and custom views, read their state, and simulate user interactions.

## Use cases
- unit test SwiftUI views
- find views of a specific type in a SwiftUI hierarchy
- read the internal state of standard SwiftUI views like Text
- verify custom view state such as @State and @ObservedObject
- simulate button taps and trigger callbacks in tests
- write asynchronous tests for views with onAppear callbacks

## When to choose
- you want to unit test SwiftUI view logic and hierarchy without snapshot testing
- you need to assert on view attributes, state, or bindings in XCTest
- you want to simulate user interactions like taps in SwiftUI tests

## When to avoid
- you need UI rendering or pixel-level snapshot tests rather than structural inspection
- your project does not use SwiftUI
- you need to add it to the production target - it is test-target only

## Facets
- artifact type: library
- maturity: active
- function: testing, developer-tools
- domain: testing, frontend, developer-tools
- platform: -
- tags: swiftui, unit-testing, runtime-introspection, view-hierarchy, xctest, ios, macos, swift

## Member repositories
- nalexn/ViewInspector (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:05.530816+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:19:40.739828+00:00, confidence not recorded.
  - readme: https://github.com/nalexn/ViewInspector (fetched 2026-08-28T04:07:05.530816+00:00, sha ba33c6bf1bc0)
- Data as of 2026-08-30T08:39:29.467469+00:00.
