SafeAreas misbehave when presenting a UIViewController

I need to present a UIViewController (ViewControllerTwo) that only supports ".landscape" orientations from another UIViewController (ViewControllerOne) that only supports ".portrait" orientation. If you check the .gif below, you will notice that when the transition occurs it shrinks the content of "ViewControllerOne" and when you dismiss "ViewControllerTwo" the same happens.


The reason why this happens is related to the change of safe areas, which in portrait are different from landscape and vice versa. But if we override supportedInterfaceOrientations of "ViewControllerOne" to just support ".portrait" it should not be informed of the safe area changes if these changes relate to an unsupported orientation right?


Is this a bug/limitation from iOS?

(NO) -> What is the right way to handle this scenario?

(YES) -> What workaround do you recommend to solve this issue in the meantime?



You can check the Example Project here: https://github.com/mantuness/ExampleProject

Something I do not understand from a user experience perspective: that means that you force to rotate the device when transitioning between the views ?


I do not see this as a bug.


Work around could be to not use safe area (in IB) and manage them by code (limited to an area that is the minimum of the 2 safe areas in Portrait and Landscape).

Is that really worth the effort ?

Hi @Claude31,
Thanks for your response in advance! 😉
The question here is, VC1 is locked to portrait, VC2 is locked to landscape. As you know the safe areas are different from each other when in portrait and when in landscape. If I locked VC1 to portrait it means that the safe areas of that viewController never change because independently of the device orientation it will keep portrait. The problem happens when I present VC2 from VC1, iOS informs VC1 about landscape safe areas and it shouldn't because that VC is locked to portrait.
Check this gif -> https://github.com/mantuness/ExampleProject/blob/master/ExampleProjectGIF.gif

SafeAreas misbehave when presenting a UIViewController
 
 
Q