A wonderful layout component called the UIStackView
was introduced with iOS 9. With this component it is really easy to layout components in a row both horizontally and vertically. Apple recommends using the UIStackView
wherever possible and resort to explicit NSLayoutConstraints
only when there is no way to do it with UIStackView
. This saves you lots of boiler plate NSLayoutConstraint
creation code.
UIStackView
requires iOS 9, but we’re not ready to make our apps require iOS 9+ just yet. In the meanwhile, we developers are eager to try this component in our apps right now! This is why I created this replica of the UIStackView
, called the TZStackView
(TZ = Tom van Zummeren, my initials). I created this component very carefully, tested every single corner case and matched the results against the real UIStackView
with automated XCTestCases
.