I am using PencilKit
in my app and let my users draw images on PKCanvasView
.
But I don't want them to be able to save blank drawings. So I need to check if PKDrawing
is blank (doesn't contain anything besides transparent pixels). I couldn't find any specific method for it in the official documentation.
I've tried to convert the PKDrawing
to Data
and check if it is empty but it is never the case even when drawings are blank.
Is there a handy way to check if the PKDrawing
or PKCanvasView
are empty?
Alternatively, is there a way to check if UIImage
consists only of transparent pixels?