Unfortunately using .accessibilityElement(children: .contain) cause huge memory leak, more like memory flood, as Accessibility framework holds reference to view which in tern holds models and all the dependents. See: https://developer.apple.com/forums/thread/689078
Leak manifests not only in UITests but by any accessibility use, even accessing it via Accessibility Inspector or Voice Over.
See issue described here: https://developer.apple.com/forums/thread/689078
and sample project to reproduce the problem: https://github.com/yuri-qualtie/MemoryLeaks
Is there another way to add accessibility identifier to a SwiftUI container without causing leaks?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: