CocoaPods GitHub release Build Status codecov CocoaPods

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.


LinkedIn created LayoutKit because we have found that Auto Layout is not performant enough for complicated view hierarchies in scrollable views. For more background, read the blog post.


LayoutKit has many benefits over using Auto Layout:

LayoutKit also provides benefits that make it as easy to use as Auto Layout:

Hello world

let image = SizeLayout<UIImageView>(width: 50, height: 50, config: { imageView in
    imageView.image = UIImage(named: "earth.jpg")

let label = LabelLayout(text: "Hello World!", alignment: .center)

let stack = StackLayout(
    axis: .horizontal,
    spacing: 4,
    sublayouts: [image, label])

let insets = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 8)
let helloWorld = InsetLayout(insets: insets, sublayout: stack)
helloWorld.arrangement().makeViews(in: rootView)

Hello world example layout


We have found LayoutKit to be a useful tool, but you should be aware of what it is not.


LayoutKit can be installed with Cocoapods or Carthage.


Add this to your Podspec:

pod 'LayoutKit'

Then run pod install.


Add this to your Cartfile:

github "linkedin/LayoutKit"

Then run carthage update.

Next steps

Now you are ready to start building UI.