PureLayout vs SnapKit — Great confrontation

At first, let me clear something out. I’m heavy PureLayout user. I’ve been creating my UIs in code for some time now and it’s not looking like I’m going back to Interface Builder any time soon. I’m not saying IB is bad, but it’s just not the way that I do things. I started working with PureLayout back in Objective-C days and I kept on using it in Swift as well. However, recently I’ve been interested in a framework called SnapKit, that offers a nice “swifty” way of building views in your application. This post is my way of getting into SnapKit. Below, you can find some UI examples, that I’ve written using both PureLayout and SnapKit.

Simple positioning

Inside UIScrollView

UIScrollView with a surprise

Updating constraint’s constant


Looking at those examples, you can decide which style of UI you prefer. Personally, I must admit that I really like the way that SnapKit works. I won’t be rewriting my existing PureLayout to SnapKit codebase, but I’ll surely take SnapKit into consideration, when starting a new project.

This article is cross-posted with my personal blog www.eliaszsawicki.com