I can’t find a way to correctly implement a cancellable child view controller transition like UINavigationController
does, because endAppearanceTransition
doesn’t let you specify whether the transition was cancelled.
2 hours later: The solution for cancelling a child view controller transition is to call beginAppearanceTransition
a second time when cancelling.
For the view that ends up staying visible:
// When the transition starts.
beginAppearanceTransition(false, animated: true)
// When the transition is cancelled.
beginAppearanceTransition(true, animated: false)
endAppearanceTransition()
The solution to a warning log about ‘Unbalanced calls to begin/end appearance transitions’ was to take my balanced calls and unbalance them.