UICollectionView in landscape on iPhone X : <p>When iPhone X is used landscape, you're supposed to check safeAreaInsets to make suitably large gutters on the left and right. UITableView has the new <code>insetsContentViewsToSafeArea</code> property (default true) to automatically keep cell contents in the safe area.</p>

<p>I'm surprised that UICollectionView seems to not have anything similar. I'd expect that for a vertically-scrolling collection view, the left and right sides would be inset to the safe area when in landscape (and conversely, a horizontally-scrolling collection view would be inset if needed in portrait).</p>

<p>The simplest way to ensure this behaviour seems to be to add to the collection view controller:</p>

<pre><code>- (void)viewSafeAreaInsetsDidChange {
    [super viewSafeAreaInsetsDidChange];
    UIEdgeInsets contentInset = self.collectionView.contentInset;
    contentInset.left = self.view.safeAreaInsets.left;
    contentInset.right = self.view.safeAreaInsets.right;
    self.collectionView.contentInset = contentInset;
}
</code></pre>

<p>... assuming contentInset.left/right are normally zero.</p>

<p>(NOTE: yes, for a UICollectionViewController, that needs to be <code>self.view.safeAreaInsets</code>; at the time this is called, the change to <code>safeAreaInsets</code> has oddly not yet propagated to <code>self.collectionView</code>)</p>

<p>Am I missing something? That boilerplate is simple enough, but it's effectively necessary now for <em>every</em> collection view that touches a screen edge. It seems really odd that Apple didn't provide something to enable this by default.</p>
