NestLayout: looking for a new Swift friend?

When using a framework there is something important to take into consideration: independently of how good it is, you can not let a third party library take over a big part of your codebase.

This is specially important if your project is shared with other developers. The adoption of the framework feels riskier and more disrupting than the benefits it introduces. And sadly, this is the case with most of the Swift layout libraries out there.

For this reasons, I put together a library called NestLayout. It’s goal is to provide an easy, reliable and fast way of creating low to medium complex layouts. It all basically comes down to one only function: nest().


You can even call it syntactic sugar for UIStackViews, because that is mostly it. Just look how simple and declarative is:

The result:

  • The layout logic is implemented by Apple and the UIStackView class (AutoLayout is working behind the scenes), not a third party developer. This means that it is reliable in terms of good performance and minimal implementation bugs.
  • The API exposed by this framework will not change as long as the API exposed by UIStackView does not change. This means that it is reliable in terms of long-term maintainability.
  • The API exposed by this framework is exacly the same as the one exposed by the UIStackView class. This means that it has a minimal learning curve, and together with autocompletion is super discoverable and easy to use.
  • The source code of this framework is under 200 lines: nothing to worry about if you do not feel confortable about adding another dependency to your project.

Please, if you give it a try I would appreciate your feedback. Hope it is useful!