In Interface Builder, I use a horizontal UIStackView and want to place the items as this :
xx xx xx
every x symbolize an item. Item1 and
Programmatically for each view:
stackView.spacing = 10.0
If you want to make a custom spacing after each view and you need to support lower than iOS11:
Create a clear UIView with height and add it as an addArrangedSubview
into the stackView.
stackView.setCustomSpacing(32.0, after: headerLabel)
For more info: Stack View Custom Spacing
It's an answer based on Lumialxk's reply. Choose the stack view you want to work on, and change the spacing property to your desired value.
In a stack view,you can only define the constant space between items.It's easy to do such things,just choose the stack view in the outline and set the value of space.
Inside your horizontal stack view have three more horizontal stack views so that you can have control over spacing and distribution for each item. See screenshot below:
Swift 4 : If you want for example set a space after the first subview :
stackView.setCustomSpacing(30.0, after: stackView.subviews[0])