UIGraphicsGetImageFromCurrentImageContext() deprecated with no replacement?

I'm using UIGraphicsGetImageFromCurrentImageContext() and UIGraphicsBeginImageContextWithOptions(::_:) and they've both been deprecated in iOS 17. There is no replacement listed in the docs. Does anyone know what we're supposed to use instead for this functionality? I'm using them to add a map pin and annotation to an MKMapSnapshot.

You should use UIGraphicsImageRenderer instead.

Thanks, I'll study up. :)

What's the appropriate replacement for the opaque, and scale parameters that were in UIGraphicsGetImageFromCurrentImageContext?

Hi,

I am currently using this function to create a screenshot and blur this as a background for a dialog. I don't know how to deal with "UIGraphicsImageRenderer" to achieve the same. My code is:

` UIGraphicsBeginImageContextWithOptions(CGSize(width: p.view!.frame.size.width, height: p.view!.frame.size.height), true, 1)

        p.view!.drawHierarchy(in: p.view!.frame, afterScreenUpdates: true)
        
        //_ = UIGraphicsGetCurrentContext()
        
        let image = UIGraphicsGetImageFromCurrentImageContext()
        
        let img = UIGraphicsImageRendererContext().currentImage
        
        UIGraphicsEndImageContext()

However, when using "img" it is only white with no content in it ...

Thanks for your help,

Br Mario

UIGraphicsGetImageFromCurrentImageContext() deprecated with no replacement?
 
 
Q