Unexpected UINavigationController setViewControllers Behavior on iOS 18.2 During Animated Transitions

Hello everyone,

I've run into a peculiar behavior with UINavigationController's setViewControllers on iOS 18.2 (I guess it might be reproducible on older versions) when reordering view controllers, and I wonder if anyone can shed some light on this issue.

Initial State: The navigation stack is [A - B - C].

Without Animation: Setting [A - C - B] updates the stack to: A - C - B as expected.

With Animation: Using the same command with animation changes the stack to [A - B], oddly omitting C.

Has anyone else noticed similar behavior or knows why animations might disrupt the stack's update this way? I'd appreciate any insights or suggestions.

Thanks, Dmytro

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Unexpected UINavigationController setViewControllers Behavior on iOS 18.2 During Animated Transitions
 
 
Q