KGNAutoLayout
KGNAutoLayout
makes AutoLayout
easy!
Installing
Carthage
github "kgn/KGNAutoLayout"
CocoaPods
pod 'KGNAutoLayout'
Examples
Example App
Pin: Superview
view.pinToEdgesOfSuperview(withOffset: 20)
view.pinToTopEdgeOfSuperview(withOffset: 20)
view.pinToRightEdgeOfSuperview(withOffset: 20)
view.pinToBottomEdgeOfSuperview(withOffset: 20)
view.pinToLeftEdgeOfSuperview(withOffset: 20)
view.pinToSideEdgesOfSuperview(withOffset: 20)
view.pinToTopAndBottomEdgesOfSuperview(withOffset: 20)
Pin: Edges
view.pinTopEdgeToTopEdge(of: itemView, withOffset: 20)
view.pinRightEdgeToRightEdge(of: itemView, withOffset: 20)
view.pinBottomEdgeToBottomEdge(of: itemView, withOffset: 20)
view.pinLeftEdgeToLeftEdge(of: itemView, withOffset: 20)
Center
view.centerInSuperview()
view.centerHorizontallyInSuperview()
view.centerVerticallyInSuperview()
[view1, view2, view3].centerHorizontally(to: parentView, withSeparation: 20)
[view1, view2, view3].centerVertically(to: parentView, withSeparation: 20)
view.centerHorizontally(to: itemView)
view.centerVertically(to: itemView)
Size
view.size(toWidth: 80)
view.size(toMinWidth: 40)
view.size(toMaxWidth: 100)
view.size(toHeight: 80)
view.size(toMinHeight: 40)
view.size(toMaxHeight: 100)
view.size(toWidthAndHeight: 80)
view.size(toMinWidthAndHeight: 40)
view.size(toMaxWidthAndHeight: 100)
view.sizeWidthToWidth(of: itemView)
view.sizeHeightToHeight(of: itemView)
view.sizeHeightToWidth(of: itemView)
view.sizeWidthToHeight(of: itemView)
view.sizeWidthAndHeightToWidthAndHeight(of: itemView)
view.sizeHeightToWidth(withAspectRatio: 16/9)
view.sizeWidthToHeight(withAspectRatio: 16/9)
Position
view.positionAbove(itemView, withOffset: 20)
view.positionToTheRight(of: itemView, withOffset: 20)
view.positionBelow(itemView, withOffset: 20)
view.positionToTheLeft(of: itemView, withOffset: 20)
[view1, view2, view3].positionAbove(itemView, withOffset: 20)
[view1, view2, view3].positionToTheRight(of: itemView, withOffset: 20)
[view1, view2, view3].positionBelow(itemView, withOffset: 20)
[view1, view2, view3].positionToTheLeft(of: itemView, withOffset: 20)
Between
view.fitBetween(top: topView, andBottom: bottomView, withOffset: 20)
view.fitBetween(left: leftView, andRight: rightView, withOffset: 20)
Fill
parentView.fillHorizontally(withViews: [view1, view2, view3], separation: 20)
parentView.fillVertically(withViews: [view1, view2, view3], separation: 20)
Bound
itemView.boundHorizontally(withViews: [view1, view2, view3], separation: 20)
itemView.boundVertically(withViews: [view1, view2, view3], separation: 20)
itemView.boundVertically(withViews: [view1, view2, view3], separation: 20)
Progress:
- Travis
- Badges
- Tests
- Carthage
- CocoaPods
- Description
- Documentation
- Example App
- AppleTV
- Prebuilt Frameworks
- Travis Test Matrix