'How to properly animate SCNView height?

I'm trying to animate SCNView height, but it seems like there are some visual issue.

When content is growing it looks like everything is ok, but when I'm trying to decrease the height, view just jumps to final height instantly.

let newHeight = scene.frame.height + (open ? 100.0 : -100.0)
UIView.animate(withDuration: 1.0, animations: {
    self.scene.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: newHeight)
}) { finished in
    self.open = !self.open
}

See Code Running in Sumulator

With regular view everything works fine.



Solution 1:[1]

There is a relationship between this behavior and the content mode of scene. You may try:

             scene.contentMode = .scaleToFill

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 E.Coms