When we get a screenshot of a UIView, we use this code usually:
UIGraphicsBeginImageContextWithOptions(frame.size, false, scale)
drawViewHie
private extension UIImage
{
func resized() -> UIImage {
let height: CGFloat = 800.0
let ratio = self.size.width / self.size.height
let width = height * ratio
let newSize = CGSize(width: width, height: height)
let newRectangle = CGRect(x: 0, y: 0, width: width, height: height)
UIGraphicsBeginImageContext(newSize)
self.draw(in: newRectangle)
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage!
}
}