The better way to do it is by using Visual format language but I can't help you out with an answer with context to VFS because I personally don't use it.
But if you want to do it with NSLayoutConstraint then it can be done in a very easy way.
I am not writing the exact code but would explain to you how you have to deal this out.
Note - Don't forget to set translatesAutoresizingMaskIntoConstraints = false
and Don't forget to set isActive = true on all the constraints which you want to keep active.
because if you forget to do it then your code won't work
Then align left label1 to the parent view you can either do this by anchors or NSLayoutConstraints I would recommend doing it with Anchor.
label1.leadingAnchor.constraint(equalTo: parentView.leadingAnchor, constant: 0).isActive = true
Then align other label's leading edge to the trailing edge of the previous one like -
label2.leadingAnchor.constraint(equalTo: label1.leadingAnchor, constant: 0).isActive = true
and finally, align the rightmost label to the trailing edge of parent view like -
rightMostLabel.trailingAnchor.constraint(equalTo: parentView.trailingAnchor, constant: 0).isActive = true
Then set the top alignment of the label1 with respect to the parent view
label1.topAnchor.constraint(equalTo: parentView.topAnchor, constant: 0).isActive = true
Then finally set the width of all the labels equal to any one of the label. Let's say, we set the width of all the labels equal to label1.
by-
NSLayoutConstraint(item: label1, attribute: .width, relatedBy: .equal, toItem: label2, attribute: .width, multiplier: 1, constant: 0).isActive = true
This code above was with label1 and label2 you would have to do it again with label2 and label3 and so on.