Present Code
At the moment I’ve the next code for AnimationView.swift
import Basis
import UIKit
class AnimationView: UIView {
personal let backgroundView = UIView()
personal let foregroundView = UIView()
override init(body: CGRect) {
tremendous.init(body: body)
...
And in addition I’ve the next code for ViewController.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
tremendous.viewDidLoad()
// Do any extra setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
let x = AnimationView(body: .zero)
...
Drawback
The block animation code has points associated to the view controller’s life cycle and whether or not or not it was added to the view hierarchy earlier than calling UIView.animate(...)
. Ideally, I need the animation to only run repeatedly on a loop with none interruptions or issues about these elements. Anybody have any options?
UIView.animate(withDuration: 2.0, delay: 0, choices: [.autoreverse, .repeat], animations: {
self.foregroundView.remodel = CGAffineTransform(scaleX: 0.3, y: 0.3)
}, completion: nil)