title: How to update a progress view that is on another UIViewController - SWIFT?
body: <p>I have a <code>UITableViewController</code> that is embedded in a <code>UINavigationController</code>.  When I click on a row I am attempting to upload a file.  To show the progress of this upload I have decided to use custom popup (another <code>UIViewController</code>) - if anyone has a better idea to show the progress of the upload in this context I am open to it.</p>
  
  <p>The only idea I have to transfer continuous data from one <code>UIViewController</code> to another (if that is possible) is by using a Singleton.  My code is below, my issue at the moment is I do not know how to update the progress view even though now it has access to the progress data via the singleton.</p>
  
  <pre><code>class SharedSingleton{
  
       private init(){}
       static let shared = SharedSingleton()
       var prog: Float = 0
  }   
  </code></pre>
  
  <p>UITableViewController:</p>
  
  <p>Using Alamofire to get the fraction of upload completed:</p>
  
  <pre><code> /**TRACK PROGRESS OF UPLOAD**/
   upload.uploadProgress { progress in
   //print(progress.fractionCompleted)
  
   let mySingleton = SharedSingleton.shared
   mySingleton.prog = Float(progress.fractionCompleted)
   print("mySingleton.prog: \(mySingleton.prog)")
  </code></pre>
  
  <p>UIViewController containing popup:</p>
  
  <pre><code>@IBOutlet weak var popUpContainer: UIView!
  @IBOutlet weak var uploadStatus: UILabel!
  @IBOutlet weak var progressBar: UIProgressView!
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Make popup have rounded corners
      popUpContainer.layer.cornerRadius = 5
      popUpContainer.layer.masksToBounds = true
  
  
      // Call Singleton and assign progress of upload to progress view
      // HOW TO UPDATE ??????
      let mySingleton = SharedSingleton.shared
      progressBar.progress = mySingleton.prog
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/KHA7Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KHA7Y.png" alt="enter image description here"></a></p>