| Type | Requirement | |
|---|---|---|
Platform | iOS | 8.0+ |
macOS | N/A | |
tvOS | 10.2 | |
watchOS | N/A | |
Linux | N/A | |
IDE | Xcode | 10.2+ |
Language | Swift | 5+ |
JustLayout is available on CocoaPods.
use_frameworks!pod'JustLayout'# for DSL usage:#pod 'JustLayout/DSLJustLayout is open-sourced software, licensed under the MIT license.
import JustLayoutfunc visually(){
view.layout(100,|-topView-|~80,8,|-centerView-(>=100)-|~80,"",
|bottomView| ~80,0)}func chainable(){
centerView.centerInContainer().width(100).aspectratio(followHeight:100%)
topView.left(centerView,-20).top(centerView,-20).size(centerView)
bottomView.left(centerView,20).top(centerView,20).size(centerView)}func operatorBased(){
bottomView.centerXAttribute == view.centerXAttribute
bottomView.centerYAttribute == view.centerYAttribute
bottomView.widthAttribute ==80
bottomView.heightAttribute == bottomView.widthAttribute
centerView.rightAttribute == bottomView.centerXAttribute
centerView.topAttribute == bottomView.centerYAttribute
centerView.widthAttribute == bottomView.widthAttribute
centerView.heightAttribute == bottomView.heightAttribute
topView.leftAttribute == centerView.rightAttribute
topView.topAttribute == centerView.topAttribute
topView.widthAttribute ==50% centerView.widthAttribute
topView.heightAttribute == centerView.heightAttribute
}The
Operator-Basedlayout is now chainable after version1.4.0. For example:someView.following(leftView).below(topView).size(centerView)someView.leftAttribute == leftView.rightAttribute someView.topAttribute == topView.bottomAttribute someView.widthAttribute == centerView.widthAttribute someView.heightAttribute == centerView.heightAttribute
After version 1.5.0 you can now use the JustLayoutDSL:
centerView.just.centerInContainer().width(100).aspectratio(100%)
topView.just.left(centerView,-20).top(centerView,-20).size(centerView)
bottomView.just.left(centerView,20).top(centerView,20).size(centerView)Important | Please add |
Made with [heart] by Elias Abel.
