func asImage() -> UIImage {
let renderer = UIGraphicsImageRenderer(bounds: bounds)
return renderer.image { rendererContext in
layer.render(in: rendererContext.cgContext)
}
}
This code runing on xcode15.4 with ios18.0 of 14pro device.
The results are bleak compared to the original display.
for ios12-ios17 all system is right.