Code Block VStack { // identifier a View1 // identifier b View2 // identifier c }
When trying to use .accessibilityIdentifier(identifier) with any SwiftUI Stack, the identifier is applied to everything inside the VStack and overrides any identifiers that View1 or View2 may have had.
The current workaround is to use a GroupBox Container View to wrap the VStack. It achieves the desired result of having different levels of accessibility identifiers but has the drawback of coming with some styling (adds padding).
Is there a better way to go about adding accessibility identifier to a container view?
See Example playground