Last active
August 10, 2024 15:39
-
-
Save ras0q/4d369abacbcdd77ad7cd31920f03db8c to your computer and use it in GitHub Desktop.
UIKitにPencilKitを組み込む最小構成
This file contains hidden or 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 PencilKit | |
| import UIKit | |
| class ViewController: UIViewController { | |
| private lazy var canvasView = PKCanvasView(frame: view.frame) | |
| private lazy var toolPicker = PKToolPicker() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| view.addSubview(canvasView) | |
| 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