iOS eco-system has grown to support a plethora of iOS devices in the market. They all are different in shapes and dimensions which present a unique challenge for app developers to optimize apps for different size and context. But how can we do that? The answer is Adaptivity.

Why Adaptivity?

With adaptivity, we can layout interface specially formatted for the environment. If the environment has limited space, we might want to display the most important and simplified piece of information. On the other hand, if the environment has ample amount of space, then we can layout our apps to display sufficient content.

One of the tools that Xcode provides is AutoLayout. For small adaptivity conditions (same layout across all orientations) AutoLayout works fine. But for different layout across different device size and orientation, another tool should be used i.e. Trait Collection.

Size Class

A size class is a specification of a display’s width or height that can be used to describe a family of devices and orientations. All widths and heights fall into one of two size classes — compact or regular.

iOS Devices Size Classes

One should be aware of size classes while designing an adaptive layout.

Enough talk?🙊 Let’s get started