When conditionally hiding views in SwiftUI, leaving a Spacer() in the layout causes invisible gaps because the Spacer still occupies space even when the associated view is hidden. The fix is to remove the Spacer along with the hidden view, ensuring layout logic matches the visibility state.

1m watch time

Sort: