From 00efcc2bcf1bd8f5e4c29db5a7dc58a7b0b5c4cb Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 5 Aug 2026 09:37:56 -0700 Subject: [PATCH] Defer the pending article page flush until the swipe transition has finished, to avoid a UIKit assertion crash. Fixes #5384. --- iOS/Article/ArticleViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index db4573ba7..c6ec82d65 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -525,7 +525,15 @@ extension ArticleViewController: UIPageViewControllerDelegate { if let pending = pendingSetViewController { pendingSetViewController = nil - pageViewController.setViewControllers([pending], direction: .forward, animated: false, completion: nil) + // Async because UIKit is still finishing the swipe — a synchronous + // setViewControllers here triggers an assertion in _UIQueuingScrollView. + DispatchQueue.main.async { + if self.isPageTransitionInProgress { + self.pendingSetViewController = pending + } else { + self.pageViewController.setViewControllers([pending], direction: .forward, animated: false, completion: nil) + } + } } guard finished, completed else { return }