PY
Size: a a a
PY
SS
S
S
РХ
PY
PY
A
UIStackView
, ставя ему heightAnchor = 0
, на результате получаю такую анимашку.private func animate() {
guard let zeroHeightAnchor = stackViewZeroHeightAnchor, !isAnimationRunning else { return }
isAnimationRunning = true
stackView.spacing = stackView.spacing == 0 ? 10 : 0
zeroHeightAnchor.isActive = !zeroHeightAnchor.isActive
backgroundColorView.isHidden = !backgroundColorView.isHidden
UIView.animate(withDuration: 1, delay: 0, options: [], animations: {
self.layoutIfNeeded()
}, completion: { _ in
self.isAnimationRunning = false
})
}ДЖ
DH
ДЖ