Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source Swift Library Allowing You To Create Complex Auto Layout Layouts from Code


Previously I mentioned the FLKLAutoLayout that allows you to easily create complex auto layouts from code.

Here’s an auto layout helper library created in Swift from Robert Böhnke inspired by FLKAutoLayout.

Cartography supports all of the auto layout attributes available in for auto layout in iOS 7, and to use it you simply need to supply Cartography with your views, and specify the different attributes within a closure making for a very clean readable syntax.

Here’s an example from the readme showing the syntax for Cartography:

layout(view1, view2) { view1, view2 in
    view1.width   == (view.superview!.width - 50) * 0.5
    view2.width   == view1.width - 50
    view1.height  == 40
    view2.height  == view1.height
    view1.centerX == view.superview!.centerX
    view2.centerX == view1.centerX

<pre><code> &gt;= view.superview!.top + 20 == view1.bottom + 20


You can find Cartography on Github here.

A nice Swift library for working with auto-layout.


Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.