Change ComposeDrawingViewController to use drawingPolicy on iOS 14

This commit is contained in:
Shadowfacts 2020-06-23 19:33:14 -04:00
parent 154fc7cd02
commit 50f1a9a7de
1 changed files with 6 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class ComposeDrawingViewController: UIViewController {
canvasView.drawing = initialDrawing
}
canvasView.delegate = self
if #available(iOS 14.0, *) {
canvasView.drawingPolicy = .anyInput
} else {
canvasView.allowsFingerDrawing = true
}
canvasView.minimumZoomScale = 0.5
canvasView.maximumZoomScale = 2
canvasView.backgroundColor = .systemBackground
@ -75,6 +79,7 @@ class ComposeDrawingViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// todo: should the PKToolPicker be owned by this VC or something else?
if let window = parent?.view.window, let toolPicker = PKToolPicker.shared(for: window) {
toolPicker.setVisible(true, forFirstResponder: canvasView)
toolPicker.addObserver(canvasView)