No, I don't think there is a way to find a SwiftUI view via its accessibilityIdentifier. If your intent is to retrieve the frame of a Text and do something based on that in a parent view, GeometryReader + PreferenceKey / anchorPreference will be the way to go, even though it needs some additional code. In iOS 16, onGeometryChange(for:of:action:) allows you to perform an action when a geometry value of a view changes. If you target iOS 16 and later, that may be even easier. Best, —— Ziqiao Chen Worldwide Developer Relations.
Topic:
UI Frameworks
SubTopic:
SwiftUI