Creating iOS Apps without Storyboard – Part 2

Summary

The simplest implementation is achieved using the Layout Anchors & UIStackViews. Visual Format Language has the advantage that it allows us to visualise the constraints, but has limitation on the kinds of constraints that can be applied. NSLayoutContraints class approach is verbose where in we have to provide information even if it is not required.

The best approach, really, is to use storyboards. Use the programmatic approach only if you want to dynamically create constraints orif you want to dynamically create UI elements.

Video

Here is a short video I have created on this topic. I basically go over the same code and provide some explanation on how I built the project.

Download the Source Code

You can download the starter project, which is a basic project with all the other necessary code written for you. You can directly jump in and add the the constraints.

Here is the link to the completed project using Layout Anchors.

Here is the link to the completed project using Visual Formatting Language.

Here is the link to the completed project using NSLayoutConstraints.

All the projects have the implementation for the traitCollectionDidChange method.


Related Articles

Advertisement

One thought on “Creating iOS Apps without Storyboard – Part 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s