Skip to content

DaskiOFF/RKAutoLayout

Repository files navigation

RKAutoLayout

CI Status Cocoapods compatible codecov docs Version Platform Swift Version License

Easy AutoLayout

TL;DR

let view1: UIView = UIView()
let view2: UIView = UIView()

view1.addSubview(view2)

/// Add all
view1.rk_alAdd(
    size: [.width(view2), .height(100)], 
    center: [.centerX()], 
    edge: [.top(10), .bottom(view2, offset: -34)], isActive: false)
view1.rk_alAdd(size: [.height(100)], edge: [.top(min: 10), .bottom(view2, offset: -34)], isActive: false)
view1.rk_alAdd(center: [.centerX()], edge: [.top(10), .bottom(max: view2.topAnchor, offset: -34)])

/// Edges
view1.rk_alEdgeSuperViewBounds()
view1.rk_alEdge(.top(200))
view1.rk_alEdge(.top(bottomAnchor, offset: -43))
view1.rk_alEdge(.top(0), .left(10), isActive: false)

/// Size
view1.rk_alSize(.width(50), .height(view2, multiplier: 3))
view1.rk_alSize(.width(view2.heightAnchor, priority: .low), .height(view2))
view1.rk_alSize(.width(200), .height(min: 60), .height(max: 220))

/// Center
view1.rk_alCenterSuperView()
view1.rk_alCenter(.centerX(100), .centerY(300))
view1.rk_alCenter(.centerX(), .centerY(view2.topAnchor))
view1.rk_alCenter(values: RKConstraintCenter.center(view2, offsetX: -100, offsetY: -100))

/// Baseline
view1.rk_alBaseline(.firstBaseline(100), .lastBaseline(300))

Requirements

  • iOS 9.0 and above
  • Swift 4.1

Documentations

Full documentation for the latest release is available here

Installation

RKAutoLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'RKAutoLayout', '~> 0.2'

Author

DaskiOFF, [email protected]

License

RKAutoLayout is available under the MIT license. See the LICENSE file for more info.

Последний раз проект собирался с версией Xcode указанной в файле .xcode-version (Подробнее)

Последний раз проект собирался с версией Swift указанной в файле .swift-version