SnapKit is Awesome!

Recently, I posted that I had stopped using storyboards in projects I’ve started. This feels a daunting prospect when you’re used to relying on storyboards. However, building views programatically it isn’t as bad as it first seems. This is especially true if you use a library to abstract the native Auto Layout API’s provided by Apple.

Here is an interesting Reddit thread about SnapKit. It has the usually overly zealous opinions developers like to give about right and wrong. Shock!

The title of this post adequately sums up where I stand on SnapKit. Since I’ve been building my layouts programatically, I’ve really enjoyed using SnapKit. It felt intuitive from day one so I didn’t have to spend too long fumbling through documentation to get to grips with a new API. In my opinion the APIs provided by Apple for working with Auto Layout are still a little verbose.

Example

The example below hardly takes any explaining. It lays out a button 12 points bellow a text field that is 60 points high and as wide as its superviews layout margins. Nice!

If you want to start building views programatically, I highly recommend giving SnapKit a look.

Here is the documentation for SnapKit