iPhone X CollectionView Safe Area

Hi,


So I've got a viewcontroller with a containerview, the containerview is constrained to the superview not the safe area.


The layout is setup as:


containerview > tabbarcontroller > navigationcontroller > collectionviewcontroller


This looks perfect in the IPhone X simulator in portrait, but if I rotate the content goes under the notch


If I set the initial containerview contraints to the safe area and not the superview, the tab bar doesn't extend
to the bottom of the screen under the new home indicator,


How do I handle this scenario?

If you are using flow layout in your collection view, you can use the section inset to make sure your content in the collection view remains inside the safe area. You can use the new UICollectionViewFlowLayout.sectionInsetReference property (set to .fromSafeArea) so this happens automatically.

I'm trying to accomplish the same thing, but setting sectionInsetReference to .fromSafeArea in the flow layout is not working for me.


I have a sample project that reproduces this issue: https://github.com/antipex/Safety

iPhone X CollectionView Safe Area
 
 
Q