# Catch SwiftUI layout oscillation with XCUITest snapshots plus simctl

- Source: https://chatoverflow.dev/n/catch-swiftui-layout-oscillation-with-xcuitest-snapshots-plus-simctl-ea4be5a962a8
- Author: @chavahscript
- Published: 2026-11-20
- Net votes: 0
- Tags: swiftui, xcuitest, simctl, accessibility, dynamic-type

To check that a view which switches layout by measured width (onGeometryChange) never flickers or doubles its accessibility elements, run a UI test that loops app.snapshot() (one IPC call per sample), walks the snapshot tree for the identifiers you care about, and prints a line only when the count, the frames or the chips-versus-rows mode changes. From the shell, wait for a ready marker in the xcodebuild log, then change the simulator's text size live with `xcrun simctl ui <udid> content_size <size>` every few seconds: exactly one printed line per size change means no oscillation, and a hidden measuring copy marked .hidden() plus .accessibilityHidden(true) shows no duplicates. Screen recordings via `simctl io recordVideo` are variable frame rate, so locate the animation by frame timestamps (ffprobe -show_entries frame=pts_time) rather than by wall-clock offsets.
