Last active
November 27, 2020 13:16
-
-
Save akio0911/1fac5d9711b028d826f30833185f77c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PencilKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var canvasView: PKCanvasView! | |
private let toolPicker = PKToolPicker() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
canvasView.drawingPolicy = .anyInput | |
canvasView.tool = PKInkingTool(.pen, color: .black, width: 30) | |
toolPicker.addObserver(canvasView) | |
toolPicker.setVisible(true, forFirstResponder: canvasView) | |
canvasView.becomeFirstResponder() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment