Updated
I\'m using the sinch library to make video call in my app. I\'ve button to take screenshot for the whole screen during the video call :
Well I usually use this code if I want to trigger a simple screenshot:
static func screenshotOf(window: UIWindow) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(window.bounds.size, true, UIScreen.main.scale)
guard let currentContext = UIGraphicsGetCurrentContext() else {
return nil
}
window.layer.render(in: currentContext)
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
UIGraphicsEndImageContext()
return nil
}
UIGraphicsEndImageContext()
return image
}
I guess that should work for your issue as well