To me it looks like the safe area of a view is not updated after the owning view controller's .viewWillDisappear()
method is called.
Is this intended or a bug in the framework?
The issue is easily visualised by creating a custom UIViewControllerTransitioningDelegate
that animates a smaller view in one view controller, to full screen size in another (constrained to safe areas). Then the safe areas will expand as the present animation goes on (as expected), but will not shrink as the dismiss animation goes on (not expected!). The expected behaviour would be that the safe area expands during the present animation, and shrinks during the dismiss animation.
The gif below shows the unexpected behaviour. The grey area of the presented view controller is the safe area.
I've attached the code I used to visualise this problem. ViewController.swift
presents MyViewController.swift
using FullScreenTransitionManager.swift
This is expected. Transitions in particular are meant to have relatively stable metrics (it would be odd for a view that is dismissing to suddenly pin at the safe area and then vanish, when it is meant to slide offscreen entirely for example).
In particular, if a view controller is not in the appearing state (between when we call -viewWillAppear:
and -viewWillDisappear:
) then we don't update its view's safe area, specifically as transitions usually occur between the will/did states (transition in occurs between willAppear and didAppear, transmission out between willDisappear and didDisappear).