Update For iOS 11, StackViews with Custom Spacing
Apple has added the ability to set custom spacing in iOS 11. You simply have to specify the spacing after each arranged subview. Unfortunately you can’t specify spacing before.
stackView.setCustomSpacing(10.0, after: firstLabel)
stackView.setCustomSpacing(10.0, after: secondLabel)
Still way better than using your own views.
For iOS 10 and Below
You could simply add a transparent views into your stack view and add width constraints to them.
(Label – UIView – Label – UIView -Label)
and if you keep distribution
to fill, then you can setup variable width constraints on your UIViews.
But I would consider if this is the right situation to use stackviews if that’s the case. Autolayout makes it very easy to setup variable widths between views.