Creating UIViews Programmatically in Swift

With view constraints, using PureLayout

Xiomara Figueroa
xiomara.dev

--

What to expect

  • Understanding an iOS screen
  • View Hierarchy
  • When to build views programmatically
  • How to organize your code (MVC Pattern)
  • Building custom classes (UIView)
  • An example — the Twitter iOS app
  • !Massive View Controllers
  • Setting our constraints (PureLayout)

Understanding an iOS screen

Any iOS app has a many views. Those views needs four values specified in order to be displayed: x, y, width, height.

There are three different ways of building these views: Storyboards, Nib files and Programmatically.

There is a framework in the iOS sdk (UIKit) that includes a set of standard subclasses that range from simple buttons to complex tables among a lot of other view objects. For example, a UILabel object draws a text string and a UIImageView object draws an image.

--

--