Little chance that you will find iOS developer, who hasn’t heard about child view controllers. But this undervalued functional remains not very popular in daily usage, while creating custom and complex interfaces.
The main benefits of using child view controllers:
Configure interfaces depending on screen size of iPhone
Nowadays iOS developers must support around 6 different screens sizes of iPhones. This often requires to use different values when building interfaces for smaller and bigger devices. Usually, if you’re building interface from code, it looks like this somewhere in your view class:
This bunch of if/else doesn’t look sexy, and even worse, it has a chance to expand if you need to cover other devices separately. And when you have custom UI in your app, often you would need to provide such an approach in almost all of your screens.
There are two main things, that I will demonstrate and explain in this article:
UIKit supplies us with a short amount of built-in transitions, that we regularly use while implementing a transition from one view controller to another. The most popular are modal present and navigation push. Because of their simpleness and wide common usage, such transitions could be boring and won’t make users excited in case when app’s design is fully custom.
A great solution would be to use possibilities of UIViewControllerAnimatedTransitioning and UIViewControllerInteractiveTransitioning protocols that stand for creating custom interactive transitions.
The second thing is about frequently used…