linkedin / LayoutKit
- понедельник, 27 июня 2016 г. в 03:12:23
Swift
LayoutKit is a fast view layout library for iOS.
LayoutKit is a fast view layout library for iOS.
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:
let helloWorld = InsetLayout(
insets: UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 8),
layout: StackLayout(
axis: .horizontal,
spacing: 4,
sublayouts: [
SizeLayout<UIImageView>(width: 50, height: 50, config: { imageView in
imageView.image = UIImage(named: "earth.jpg")
}),
LabelLayout(text: "Hello World!", alignment: .center, config: { label in
label.textColor = UIColor.whiteColor()
})
]
),
config: { view in
view.backgroundColor = UIColor.blackColor()
}
)
helloWorld.arrangement().makeViews()
We have found LayoutKit to be a useful tool, but you should be aware of what it is not.
LayoutKit is packaged as a Cocoapod.
Add this to your Podspec:
pod 'LayoutKit'
Then run pod install
.
Now you are ready to start building UI.