Animating a UIView

suggest change
let view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
view.backgroundColor = UIColor.orange
self.view.addSubview(view)
UIView.animate(withDuration: 0.75, delay: 0.5, options: .curveEaseIn, animations: {
    // Move to the top-left of self.view. self.view.frame.origin is in
    // the superview's coordinates, so it is not the origin inside self.view.
    view.frame.origin = .zero
}) { finished in
    view.backgroundColor = .blue
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents