{"repo":"nalexn/ViewInspector","free":true,"listed":false,"github":"https://github.com/nalexn/ViewInspector","clone":"git clone https://github.com/nalexn/ViewInspector.git","description":"Runtime introspection and unit testing of SwiftUI views","language":"Swift","stars":2629,"topics":["swiftui","swiftui-views","unit-testing","runtime-typechecking","best-practices","swift","swift5"],"license":"MIT","category":"mobile-apps","readme_excerpt":"ViewInspector 🕵️‍♂️ for SwiftUI ViewInspector is a library for unit testing SwiftUI views. It allows for traversing a view hierarchy at runtime providing direct access to the underlying View structs. Why? SwiftUI view is a function of state. We could provide it with the input but could not verify the output... Until now! Helpful links Inspection guide SwiftUI API coverage Use cases 1. Search the view of a specific type or condition Use one of the find functions to quickly locate a specific view or assert there are none of such: Check out this section in the guide for the reference. 2. Read the inner state of the standard views Standard SwiftUI views are no longer a black box: Each view has its own set of inspectable parameters, you can refer to the API coverage document to see what's available for a particular SwiftUI view. 3. Verify your custom view's state Obtain a copy of your custom view with actual state and references from the hierarchy of any depth: The library can operate with various types of the view's state, such as @Binding , @State , @ObservedObject and @EnvironmentObject . 4. Trigger side effects You can simulate user interaction by programmatically triggering system-control callbacks: The library provides helpers for writing asynchronous tests for views with callbacks. FAQs Which views and modifiers are supported? Check out the API coverage. Is it using private APIs? ViewInspector is using the official Swift reflection API to dissect the view structures. So it","default_branch":null,"files":null,"tree":[],"storefront":"/r/nalexn","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nalexn/ViewInspector/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}