Size classes and Interface Builder

Storyboard and XIB files can be used in conjunction with size classes. You can think of this as the ability to specify different layouts in the same file without adding a single line of code.

This is obviously a huge improvement to our workflow; among other things, we can now define universal applications using the same Storyboard for iPad and iPhone without duplicating all the IBOutlet and IBAction connections and subsequently update just a single file instead of keeping two different Storyboards synchronized.

Hands-on code

Let's explore this with a simple example of how easy it is to handle size classes with Interface Builder.

The main goal of the next example is creating a layout that's suitable for iPhone and ...

Get Learning iOS UI Development 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.