Open ouberghouz opened 3 years ago
@ouberghouz I found a solution. Here is an explanation how "userInterfaceStyle" works and how to prevent it https://stackoverflow.com/questions/58501913/get-image-of-pkdrawing-in-light-mode
As a solution, you can try this
import PencilKit
extension PKDrawing {
func image(from rect: CGRect, scale: CGFloat, userInterfaceStyle: UIUserInterfaceStyle) -> UIImage {
let currentTraits = UITraitCollection.current
UITraitCollection.current = UITraitCollection(userInterfaceStyle: .light) // Here the magic. Try .dark or .light
let image = self.image(from: rect, scale: scale)
UITraitCollection.current = currentTraits
return image
}
}
can you please add a way to to change the color and the width of the signature dynamically for the same signature.