Hacker News new | ask | show | jobs
by justmedep 2343 days ago
It is easier to read but harder to debug. If you activate all constraints at the same time and something goes wrong you end up with an exception at activateConstraints. Then you would have to figure out which constraint is the cause of the exception. If you activate the constraints one by one then you will get much more helpful exceptions.

The rule that I followed was:

Use activateConstraints if you actually have a performance problem and otherwise activate constraints one by one.

However since this is a framework this rule may not apply because you don't know how it will be used.

1 comments

Why not just use a wrapper function taking in an array that activates one-by-one in debug and as a group in release builds?
Great idea IMO and wouldn't be difficult to whip up - fighting urge to add to this my native iOS projects right now...