By default in iOS 15, navigation bars are transparent when scrolled to the top, then its background appears upon scrolling down. This works if it can find a scroll view in the view hierarchy.
In my app, it's possible for the user to scroll down causing the navigation bar background to be visible, and then they could perform an action which ultimately causes the scroll view to be removed from the view hierarchy. The problem is the navigation bar is not updated to be transparent again.
How can one trigger the navigation bar to be redrawn as a result of the scroll view being removed from screen? I have tried
navigationController?.navigationBar.scrollEdgeAppearance = nil
navigationController?.navigationBar.setNeedsDisplay()
navigationController?.navigationBar.setNeedsLayout()
navigationController?.navigationBar.layoutIfNeeded()
but this unfortunately didn't do the trick - the background stays visible.