iOS 14.5
import UIKit
import PencilKit
class DrawingCanvasViewController: UIViewController {
lazy var canvasView: PKCanvasView = {
let canvasView = PKCanvasView()
canvasView.drawingPolicy = .anyInput
canvasView.translatesAutoresizingMaskIntoConstraints = false
return canvasView
}()
lazy var toolPicker: PKToolPicker = {
let toolPicker = PKToolPicker()
toolPicker.addObserver(self)
return toolPicker
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(canvasView)
canvasView.frame = view.bounds
toolPicker.setVisible(true, forFirstResponder: canvasView)
toolPicker.addObserver(canvasView)
canvasView.delegate = self
canvasView.becomeFirstResponder()
}
}
extension DrawingCanvasViewController: PKToolPickerObserver, PKCanvasViewDelegate {
}
The thing was here:
lazy var toolPicker: PKToolPicker = {
let toolPicker = PKToolPicker()
toolPicker.addObserver(self)
return toolPicker
}()
You need to make the tool picker lazy var and add observer to itself.
Thanks to Recoding Channel on Youtube
Nice tutorial
https://youtu.be/f2SHsHsjTGM
Post
Replies
Boosts
Views
Activity
Hi, Bruno!
I had the same situation at start as you: no serial number, no watchOS number.
Then I turned on wifi on watches, so all my devices (macbook, iPhone and watch) were in the same network. after that all these numbers appeared, but still no connection, "trying to connect..."
Then I unpaired iPhone and watch from the "Manage Run Destination" menu, and started all over.
First connected my iPhone through a cable to MacBook (developer mode is on) - no problem.
But now on the watches appeared the same menu under privacy settings developer mode - and it was - off.
Then Xcode said fetching debug symbols... all that stuff. and it works eventually
I wish you luck, I was banging my head a long time