We wanted to hide and show single or multiple views arranged in stack view whenever it is required. So, all what we did is simply:
stackView.arrangedSubviews[0].isHidden = false
stackView.arrangedSubviews[1].isHidden = true
stackView.arrangedSubviews[2].isHidden = false
However, the result is not as expected where stack view or views arranged in the stack view ignores in some cases to be hidden or shown!!
We've found this workaround to fix hide / show multiple views arranged in stack view:
extension UIView {
var isHiddenInStackView: Bool {
get {
return isHidden
}
set {
if isHidden != newValue {
isHidden = newValue
}
}
}
}
Surprisingly, this workaround is working fine but we're wondering if anything else more reliable solution that we can do to avoid causing this bug again later in the future updates?