title: Screenshot of a VC that is not on the screen
body: <p>I need to take an screenshot of a view that is part of another view controller which is not on the screen. </p>
  
  <p>I believe that I need to create that VC, fill it with the correct data, "render it" and then take the screenshot, how could I do so?</p>
  
  <p>This is my current code which is triggering the viewDidLoad() from the target VC but is producing a blank image:</p>
  
  <pre><code>    let storyboard = UIStoryboard(name: "Main", bundle: nil)
      let vc = storyboard.instantiateViewController(withIdentifier: "ShareVC") as! ShareTransactionViewController
      vc.transaction = self.transaction
  
      vc.view.drawHierarchy(in: self.view.bounds, afterScreenUpdates: false)
  
      UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, true, 0.0)
  
      let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
      UIGraphicsEndImageContext()
  
      let imageToShare = [ image ]
  </code></pre>
  
  <p>Thank you in advance</p>