- Springs & Struts
- Autolayouts
- StackView
- ReactiveCocoaLayout
- ComponentKit
- frame absolute positioning
- autoresizing masks
- easy to understand how it works and easy to debug
- works really fast
- messy to work with complex dynamic layouts
- imperative
- different devices screen sizes adds more complexity to implementation
Allows to describe layouts in a reactive way GitHub
- works fast
- animations through ReactiveAnimation
- open-source
- declarative
- alpha
- no Interface Builder support
- objective-c
- unidirectional layout update (top-down) (easier to debug / but harder to propagate changes upstream)
- ReactiveCocoa
From Facebook known for their react.js which was basically an inspiration for ComponentKit
- declarative
- flex-box model
- open-source
- not supported anymore (but developers promised some swift implementation)
- no Interface Builder support
- objective-c++
Based on Cassowary constraint solving toolkit developed by Greg Badros and Alan Borning.
"H:|-(==10@750)-[button(>=50)]-(>=10,<=10)-|"
override func intrinsicContentSize() -> CGSize {
return CGSize(
width: 320,
height: UIViewNoIntrinsicMetric)
}
H:[view1]-(>=100@500)-[view2] H:[view1]-(<=60@499)-[view2] - Still tries to satisfy inequality
Intrinsic content size width = 200 height = 400
Transforms to set of constraints H:[view(>=200@(Compression Resistance Priority))] H:[view(<=200@(Hugging Priority))]
V:[view(>=400@(Compression Resistance Priority))] V:[view(<=400@(Hugging Priority))]
- Size classes (UITraitCollection)
- New attributes
- Activate/Deactivate constraints
- New attributes
- UIStackView
- Anchors
- UILayoutGuide
- Android linear layout You should definately use it.
- are constraint fabric
- pretty good solution for some layouting problems
- not supported in Interface Builder
- Necessity and Sufficiency
- Adaptivity
- Declarative
- Interface Builder
- Swift
- Slower then Springs & Struts
command alias objcpo po -l objc++ -O --
command alias objcexpr expr -l objc++ -O --
po view.performSelector("_autolayoutTrace")
objcpo [[UIWindow keyWindow] _autolayoutTrace] // prints layouts ambiguity
objcpo [view constraintsAffectingLayoutForAxis:0] // horizontal
objcpo [view constraintsAffectingLayoutForAxis:1] // vertical
[view hasAmbiguousLayout] // BOOL
[view exerciseAmbiguityInLayout] // visualizing ambiguity
expr (void)[CATransaction flush]
Facebook/Chisel