Home

Awesome

🚨 UNMAINTAINED 🚨

This project is no longer used by LinkedIn and is currently unmaintained.

LayoutKit

CocoaPods GitHub release Build Status codecov

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

Motivation

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.

Benefits

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

Limitations

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

Installation

LayoutKit can be installed with CocoaPods or Carthage.

CocoaPods

Add this to your Podspec:

pod 'LayoutKit'

Then run pod install.

Carthage

Add this to your Cartfile:

github "linkedin/LayoutKit"

Then run carthage update.

Documentation

Now you are ready to start building UI.