To access a VStack during UI testing of a SwiftUI application, you can use the XCUIElementQuery
API provided by Xcode's UI testing framework. Here's an example:
let app = XCUIApplication()
let vStack = app.descendants(matching: .vStack).element
This code creates an instance of XCUIApplication
and then gets the first VStack
element it finds by calling the descendants(matching:)
method and passing in the .vStack
query. You can then interact with the vStack
element, for example by tapping on it:
vStack.tap()
Asked: 2022-11-10 11:00:00 +0000
Seen: 17 times
Last updated: Nov 05 '21