ViewInspector | Runtime introspection and unit testing of SwiftUI views | Unit Testing library
kandi X-RAY | ViewInspector Summary
kandi X-RAY | ViewInspector Summary
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.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ViewInspector
ViewInspector Key Features
ViewInspector Examples and Code Snippets
Community Discussions
Trending Discussions on ViewInspector
QUESTION
I have this super basic app which changes the colour of a circle when you press a button:
...ANSWER
Answered 2021-Jul-07 at 19:16This thread states that
XCTest is for functional testing, rather than asserting visual requirements
Which is true. So what you can do if you don't want to install the ViewInspector
dependency, you can
- Make your
@State var color: Color
have the default access modifier. - Have a function that toggles the color
- Create an instance of the
View
- Test it.
Refer the screenshot below. Note that this has been done on playground, but the same can be referred on an actual project
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ViewInspector
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page