I have an app using PencilKit. I have noticed that occasionally when I am in dark mode and using the white colour, when I finish drawing and render the strokes into an image to draw, the white lines go to black.
I am using:
currentTraits.performAsCurrent {
image = drawing.image(from: visibleRect, scale: UIScreen.main.scale)
}
to create a UIImage from the drawing but it randomly, occasionally seems to get the user interface style wrong. All the colours in the image are in the wrong userinterface style trait (but white is the most visibly wrong) (ie: I am in dark mode but the UIImage generated sometimes thinks I am in light mode)
Is this a bug in iOS (14.7.1 running on an original iPad Pro) or am I doing something wrong? I have never seen this happen in light mode (black lines never go to white).
Thanks in advance.
This does seem to be an iOS bug. It is present in iOS 14 but seems to be fixed in iOS 15.