I have wriiten following code to animate my button
UIView.animate(withDuration: 1.0, animations: {
assistButton.frame = CGRect(x: self.view.frame.maxX - 75, y: self.view.frame.maxY - 120, width: width, height: height)
})
This code works fine but after some user action I want to animate this button back to original position for that written following code
UIView.animate(withDuration: 1.0, animations: {
assistButton.frame = CGRect(x: lastX, y: lastY, width: width, height: height)
})
But Above code is not working
lastX and LastY value are initialised in viewDidLoad as below
lastX = assistButton.frame.minY
lastY = assistButton.frame.minX