title: Defining a layout to save as an image - Swift
body: <p>I'm not certain whether this is possible, however, I have a page not dissimilar to an Instagram feed - it displays a map and highlights progress using a table view and cells.</p>
  
  <p>I would like to save an alteration of this layout on the press of button in a style that is more appropriate for an Instagram feed.</p>
  
  <p>I have <a href="https://www.youtube.com/watch?v=6o4PmMywIA8" rel="nofollow noreferrer">successfully created an image of the current screen</a> (although haven't proceeded to do anything with the image.</p>
  
  <pre><code> @objc func createIGImage(){
      print("Sharing image")
      UIGraphicsBeginImageContext(CGSize(width: 1080, height: 1350))
      layer.render(in: UIGraphicsGetCurrentContext()!)
   }
  </code></pre>
  
  <p>How would I go about (re)defining a layout and rendering it through code? I'm happy to send the relevant information to the function, and recreate the entire cell on button click, as opposed to altering it if necessary.</p>
  
  <p>Thank you in advance!</p>
  
  <p>--</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I presume the methods outlined <a href="https://theswiftdev.com/2017/10/31/ios-auto-layout-tutorial-programmatically/" rel="nofollow noreferrer">here</a> would be appropriate for defining the layout, but should I create a new view controller or table cell to contain the information temporarily?</p>