Sometime creating a UIImage as a buffer for image manipulation is critical for achieving the good application performance. Or with whatever reason it deem worth: Here is a short snippet to get a UIImage from any given UIView while honoring the output screen scale.
So the code is, as always, simple, with UIGraphicsContext drawing mechanic you can simply borrow the current context of certain layer, and place it on your own created layer. Then export it as UIImage.
For more information see: renderInContext
let image = myView.snapshot();