title: What is the best way to run an app in the background
body: <p>I'm making a simple app testing Lottie animation library in swift. The code is perfectly running when i lunch the app for the first time. But if i relaunch it from the background, the animation stops. </p>
  
  <p>How do i keep the animation running in the background so when i switch to another app and back again, i see the animation working. </p>
  
  <p>I just started learning swift, so i apologize in advance.  </p>
  
  <pre><code>import UIKit
  import Lottie
  
  class ViewController: UIViewController {
      @IBOutlet weak var animationView: AnimationView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          SetupAnimation()
      }
  
  func SetupAnimation() {
          let animationView = AnimationView(name: "kiss")
          animationView.frame = self.animationView.frame
          self.animationView.addSubview(animationView)
          animationView.loopMode = .autoReverse
          animationView.contentMode = .scaleAspectFit
          animationView.play()
     }
  }
  </code></pre>