DSL syntax
This release enables DSL Syntax for shorter and cleaner code.
Regular syntax | DSL syntax |
frameLayout + VStackLayout {
$0 + titleLabel
$0 + subTitleLabel
($0 + 0).flexible()
$0 + button
$0 + HStackLayout {
($0 + messageView).flexible()
($0 + 5)
($0 + iconView).padding(top: 5)
}
} |
frameLayout + VStackView {
titleLabel
subTitleLabel
FlexibleSpace()
button
HStackView {
StackItem(messageView).flexible()
SpaceItem(5)
StackItem(iconView).padding(top: 4)
}
} |
More simplify functions:
Old:
frameLayout.padding(top: 16, left: 16, bottom: 16, right: 16)
frameLayout.align(vertical: .top, horizontal: .right)
frameLayout + VStackLayout {
messageLayout = ($0 + messageView)
messageLayout.padding(top: 16, left: 16, bottom: 16, right: 16)
}
New:
frameLayout.padding(16)
frameLayout.aligns(.top, .right)
frameLayout + VStackLayout {
($0 + messageView).assign(to: &messageLayout).padding(16)
}