Implementing the regular size layout

In order to implement the layout for regular-sized devices, the traitCollection property of the details view controller is used. As mentioned earlier, the traitCollection property contains information about the current environment your app is running in. All UIView instances, UIViewControllers, UIWindows, UIPresentationControllers, and UIScreens conform to the UITraitEnvironment protocol.

This protocol dictates that all objects that conform to UITraitEnvironment must have a traitCollection attribute. They must also have a traitCollectionDidChange(_:) method. This method is called whenever the traitCollection attribute changes. This could happen if a user rotates their device or when a multitasking window ...

Get Mastering iOS 12 Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.