Episode #475

Extracting View and Layout Code into a Custom View

Series: Layout in Code

7 minutes
Published on February 4, 2021

This video is only available to subscribers. Get access to this video and 497 others.

If you look at our view controller now, it is full of code that mostly is dealing with constraints, subviews, and overall layout. This is really the job of the view. In this episode we will extract this into a new view class. We'll also introduce a reusable base class that will handle the required view initializer dance for us, making the job of creating custom view classes a bit easier.

This episode uses Swift 5.3, Xcode 12.3.