I have a subview including GMSMapView in my controller - initially it's collapsed and takes just a part of screen - then a user can expand it and see the map in fullscreen mode. The code below works however there is a strange flicker at the end of the animation Here is my code:
let screenHeight = screenSize.height
let proportionalHeight = (screenSize.width * 46.0 ) / 75.0
mapViewHeight.constant = !isMapFullscreen ? screenHeight : proportionalHeight
UIView.animate(withDuration: 1.0, delay: 0,
usingSpringWithDamping: 0.9,
initialSpringVelocity: 0,
options: UIViewAnimationOptions.curveEaseInOut,
animations: {
self.view.layoutIfNeeded()
},
completion: { finished in
if finished {
self.isMapFullscreen = !self.isMapFullscreen
}
})