iOS constraint style: addConstraints vs .isActive = true : <p>I have some code which is creating auto-layout constraints programatically, and adding them to a view.</p>

<p>There are two ways to do this - call <code>addConstraints</code> on the superView, or set <code>.isActive = true</code> on each constraint (which internally calls addConstraint)</p>

<p>Option 1:</p>

<pre><code>parent.addConstraints([
    child.topAnchor.constraint(equalTo: parent.topAnchor, constant: 20),
    child.leftAnchor.constraint(equalTo: parent.leftAnchor, constant: 5) ])
</code></pre>

<p>Option 2:</p>

<pre><code>child.topAnchor.constraint(equalTo: parent.topAnchor, constant: 20).isActive = true
child.leftAnchor.constraint(equalTo: parent.leftAnchor, constant: 5).isActive = true
</code></pre>

<p>My question is, is there any benefit to doing one over the other? (performance/etc) or does it come purely down to style.</p>

<p><em>(I don't think constraints are evaluated until the next layout pass, so I don't think it should matter that we add them one-by-one instead of in a block??)</em></p>

<p>If it is just style, what's the "more preferred" style by the community??</p>

<p><em>(personally I prefer addConstraints, however it's very close and I could be easily swayed to .isActive)</em></p>
