UIGraphicsBeginImageContext(view.frame.size) // Size of the screen view.layer.renderInContext(UIGraphicsGetCurrentContext()) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext()