UISplitViewController overlay safe area issue on iPhone XS Max landscape

Originator:indiekiduk
Number:rdar://45992876 Date Originated:November 12 2018
Status:Open Resolved:No
Product:iOS SDK UIKit Product Version:12.1
Classification:Other Bug Reproducible:Always
 
Area:
UIKit

Summary:
In my app I've been working on 3 column split view where I have a split view as a child as another split view, this is because I'd like to make my app to be consistent with other iPad Pro apps that use 3 columns like Mail and Notes. This has been working fine up until the XS Max simulator in landscape and I believe the issue is to do with its left side safe area for the notch. In landscape on this device the split view appears as an overlay (in a popover). In my experience popovers are excluded from inheriting aspects of their parent view controller and in this case it seems to be an issue with safe area insets or margins. This split view that is contained inside the overlay displays a gap on its right side with a background colour showing (see attached screenshot). The sub-splitiview's master table has not aligned to the right side of the overlay popover. I've included a sample project with the bare minimum to demonstrate the issue so hopefully it can be fixed. Please ignore that the inner split view controller does not have a secondary controller.

In trying to work around the problem I've noticed that the following hack can fix the gap appearing, if this is placed in the parent split view and modifies the child split view:

- (void)viewSafeAreaInsetsDidChange{
    [super viewSafeAreaInsetsDidChange];
    UIEdgeInsets b = self.view.safeAreaInsets;
    UIEdgeInsets newSafeArea = UIEdgeInsetsZero;
    if(b.left){
        newSafeArea.left = b.left + 15; // usually 44 + 15 (not sure why the extra 15 is necessary)
    }
    self.innerMasterSplitViewController.additionalSafeAreaInsets = newSafeArea;
}

I'd like to be able to embed a split view in another split view without needing to do any special handling of safe area or margins thanks. 

Steps to Reproduce:
1. Open attached sample project.
2. Choose iPhone XS Max Simulator.
3. Launch and rotate to landscape.
4. Tap the top left nav bar button.

Expected Results:
Should look normal

Actual Results:
Grey vertical bar down middle of screen

Version/Build:
Xcode 10.1
Sim 12.1


SafeAreaTest on iPhone XS Max portrait showing grey horizontal bar.png
https://imgur.com/a/TZn8C9R

Comments

Also a problem on iPad

The safe area insets are set to zero for a detail view controller. This is wrong on the new – homebuttonless – iPads.

By mickeylauer at Nov. 23, 2018, 8:52 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!