Interface builder safe area constraints unexpected behaviour on iPhone 8 and iPhone X

I set a view's top constraint against the safe area top edge of view controller root view using interface builder.

If I set 'view as iPhone8' in interface builder and design my layout, on iPhone X simulator, the page transition shows an upshift on the view with topAnchor against safe area while things works perfectly on iPhone 8.

As contrast, if i set 'view as iphone X' in interface builder and have no change on the existing contraints, the page transition shows an downshit on the view anchored to the safe area.


I inject some code in view controller and I found in viewDidLoad or loadView, the view with topAnchor against safe area, its frame origin seems go with a fixed value as what's been set in 'view as XXX' in interface builder.

Example:

'View as iPhoneX', on both iPhone 8 and iPhone X, frame.origin is {0,44}

'View as iPhone8', on both iPhone 8 and iPhone X, frame.origin is {0,20}


Is this value hardcoded by interface builder? or it is a bug? Shouldn't it load the view and dynamically adapt to device's safe area regardless of which view point is used in interface builder?

Interface builder safe area constraints unexpected behaviour on iPhone 8 and iPhone X
 
 
Q