Geoff Hackworth
1 min readJun 18, 2018

--

> To get the constraints, we can use the get only property “constraints”, which gives an array of constraints. To get each constraint, we can iterate through the resulted array.

If your constraints are defined in a storyboard or xib, you can just create an IBOutlet for the constraint. Then it’s trivial to change the constant for that constraint.

If you don’t need to support iOS 8 and earlier, layout anchors are a much simpler way to create constraints in code than the old NSLayoutConstraint initialiser. See https://developer.apple.com/documentation/uikit/nslayoutanchor

--

--

Geoff Hackworth

Independent and freelance software developer for iPhone, iPad and Mac