Update Screen Only When Visible on iOS

Practical step-by-step guide to updating the screen on iOS only when visible

Ruslan Dzhafarov
5 min readMay 26, 2024
Design by Salman Rahman (Behance)

The Problem

In iOS development, presenting a new view controller from an existing parent view controller is a common practice. However, this can introduce challenges when the parent view controller needs to update its content while another view controller is being presented modally. If the parent view controller updates immediately while the modal is visible, the user may not see these updates, leading to a poor user experience and potential visual glitches. To ensure a seamless experience, it’s crucial to defer these updates until the parent view controller becomes visible again.

Consider a task list app as an example. When a user taps on a task row, a task details screen is presented. On this screen, the user can complete the task. Once completed, the task should be displayed at the bottom of the list. When the user returns to the task list, you want to animate moving the task to the bottom of the list. In this article we will explore how to achieve this behavior using RxSwift, ensuring updates occur only when the parent view controller is visible, providing a smooth and user-friendly experience.

The Solution

--

--