UIKit No Storyboard: 3 ‘BASIC’ Techniques for Adapting Layouts and Designs

KD Knowledge Diet
1 min readMay 19, 2022

--

There are three concepts you must know when developing UIKit without storyboard. In fact, it is necessary even if you use storyboard, but it is absolutely necessary when writing a UI with pure code.

[1] Change Constants

When button is pressed, you are changing the constant
Change constant dynamically

By declaring a constraint as a global variable, you can change its constant dynamically. This technique is useful when you apply animation.

[2] Enable & Disable Constraints

Enable Disable Constraints
control leadingAnchor and trailingAnchor by setting it to true or false

This example uses two constraints as global variables, and control constraints by setting true or false. This technique is especially useful when you are building an app that supports landscape mode.

[3] Toggle Visibility

Toggle Visibility
Toggle Visibilty

I think everyone who develops ios applications would know this already. This is really hand for various purposes. For example, you can display user login state. This isHidden property is mostly used for user interactivity in app.

Conclusion

There are 3 basic skills you need when you develop an app without Storyboard.

  1. Change Constants
  2. Enable & Disable Constraints
  3. Toggle Visibility

--

--

KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!