uistackview vs. uilayoutguide

I am excited about the features introduced by uistackview and uilayoutguide but am struggling to understand the differences between the two and when it makes sense to use one vs. the other. Can someone explain?

Did you mean UILayoutRegion instead of UILayoutGuide?


UILayoutRegion is just a rectangle in the AutoLayout engine from/to which you can attach constraints. It's like a UIView that's transparent/hidden, which is actually what UILayoutRegion is intended to replace. For example building a layout for X elements needed to be equally spaced required the use of "spacer views"; these can now be replaced with UILayoutRegion. UILayoutRegion doesn't let you do anything you couldn't (easily) do before, it just makes things slightly more efficient (all views incur a cost, which can be avoided by using a UILayoutRegion).


UIStackView also doesn't let you do anything you couldn't do before. It just makes building stacked layouts (a la WatchKit) 10x easier.

uistackview vs. uilayoutguide
 
 
Q