In iOS 17, every time I modify the peak of a UIHostingController
in a animation block, the basis SwiftUI.View
ignores it:
class TestAnimationController: UIViewController {
var heightConstraint: NSLayoutConstraint!
// a fundamental set off
override func touchesEnded(_ touches: Set<UITouch>, with occasion: UIEvent?) {
tremendous.touchesEnded(touches, with: occasion)
heightConstraint.fixed = heightConstraint.fixed == 300 ? 100 : 300
UIView.animate(withDuration: 1.0) {
self.view.layoutIfNeeded()
}
}
override func viewDidLoad() {
tremendous.viewDidLoad()
let content material = UIHostingController(rootView: Shade.crimson)
addChild(content material)
view.addSubview(content material.view)
content material.view.translatesAutoresizingMaskIntoConstraints = false
heightConstraint = contentView.heightAnchor.constraint(equalToConstant: 100)
heightConstraint.isActive = true
contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
contentView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
contentView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
content material.didMove(toParent: self)
}
}
The result’s horrible:
It was not the case in iOS 14.5:
Does somebody have a workaround?