snapshot
Draws the contents of the view and returns them as a new image object.
Declaration
var snapshot: UIImage { get }Return Value
An image object.
Discussion
When this method is called, the view sets up a drawing environment and calls your drawing method. However, instead of presenting the view’s contents on screen, they are returned to your application as an image instead. This method should be called whenever your application explicitly needs the contents of the view; never attempt to directly read the contents of the underlying framebuffer using OpenGL ES functions.
Never call this method inside your drawing function.