UIImageRenderer
UIImageRenderer is a class in the UIKit framework introduced in iOS 10 that allows developers to programmatically render images from various content sources. It provides a modern and more efficient alternative to older methods like UIGraphicsBeginImageContextWithOptions. The primary purpose of UIImageRenderer is to generate an image from drawing code, view hierarchies, or other data.
The core of UIImageRenderer's functionality lies in its ability to create an image within a specified context.
UIImageRenderer also excels at rendering entire `UIView` objects into an image. By providing a view to the
Key advantages of using UIImageRenderer include its performance optimizations, especially when rendering complex views or drawings.