SafeAreaInsets not updating on UIContainerView child VC

Originator:Alex.p.corcoran
Number:rdar://34426568 Date Originated:9/14/17
Status:Resolved Resolved:iOS 11.1
Product:iOS Product Version:11
Classification: Reproducible:Always
 
-- Update: This is fixed as of Xcode 9.1 Beta / iOS 11.1 Beta --

Area:
UIKit

Summary:
When embedding a child UIViewController into a parent UIViewController using UIContainerView in a Storyboard, the child view controller's `safeAreaInsets` and `safeAreaLayoutGuide` are only provided updates when the child is entirely contained on screen. If any portion of the child is off screen the safe area properties do not receive updates.

The documentation for `safeAreaLayoutGuide` states:
If the view is not currently installed in a view hierarchy, or is not yet visible onscreen, the layout guide edges are equal to the edges of the view.
https://developer.apple.com/documentation/uikit/uiview/2891102-safearealayoutguide

This defect happens both when the safe area insets were equal to the edge of the screen (iPhone X - Portrait orientation) or when the safe area insets were inset from the edges of the screen (iPhone X - Landscape Orientation) prior to the child moving outside the bounds of the screen.

Steps to Reproduce:
Create a UIViewController in Storyboard
Add UIContainerView to controller
Constraints:
 container.leading = superview.leading
 container.bottom = superview.bottom constant: 1
 container.trailing = superview.trailing
 container.height = 200
Create UITableViewController in Storyboard
Create "Embed" segue from UIContainerView to UITableViewController
Add static cells to table for sample data

Build and Run on iPhone X Simulator (device not released yet)
Rotate to landscape

Expected Results:

ContentView of UITableViewCells should be inset by safeAreaInsets so content remains readable.

Actual Results:

ContentVIew of UITableViewCells is not inset, content runs behind obstructed areas of screen. Additionally, `viewSafeAreaInsetsDidChange()` is not called on childViewController.

Version/Build:

iOS 11 - Xcode 9 GM (9A235) - iPhone X Simulator

Comments


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!