condensing
This commit is contained in:
parent
a0f9470c27
commit
5b5a03b869
@ -257,13 +257,11 @@ public class MoleculeStackView: ViewConstrainingView {
|
||||
view.alignHorizontal?(horizontalAlignment)
|
||||
view.alignVertical?(verticalAlignment)
|
||||
}
|
||||
let first = items.first(where: { (stackItem) -> Bool in
|
||||
return !stackItem.gone
|
||||
}) == nil
|
||||
let first = items.first { !$0.gone } == nil
|
||||
if axis == .vertical {
|
||||
if first {
|
||||
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: useStackSpacingBeforeFirstItem ? spacing : stackItem.spacing ?? 0)
|
||||
} else if let previousView = items.last(where: { (stackItem) -> Bool in
|
||||
} else if let previousView = items.last(where: { stackItem in
|
||||
return !stackItem.gone
|
||||
})?.view {
|
||||
_ = NSLayoutConstraint(pinFirstView: previousView, toSecondView: view, withConstant: spacing, directionVertical: true)
|
||||
@ -280,7 +278,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
||||
if first {
|
||||
// First horizontal item has no spacing by default unless told otherwise.
|
||||
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: useStackSpacingBeforeFirstItem ? spacing : stackItem.spacing ?? 0)
|
||||
} else if let previousView = items.last(where: { (stackItem) -> Bool in
|
||||
} else if let previousView = items.last(where: { stackItem in
|
||||
return !stackItem.gone
|
||||
})?.view {
|
||||
_ = NSLayoutConstraint(pinFirstView: previousView, toSecondView: view, withConstant: spacing, directionVertical: false)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user