PencilKit toolPicker is not showing up

I am trying to create an app using PencilKit. I have the following code in one of my ViewControllers.

 

“`

override func viewDidAppear(_ animated: Bool) {
  super.viewDidAppear(animated)

  guard
  let window = view.window,
  let toolPicker = PKToolPicker.shared(for: window) else { return }

  toolPicker.setVisible(true, forFirstResponder: canvasView)
  toolPicker.addObserver(canvasView)
  canvasView.becomeFirstResponder()
}

“`

 

Although I am calling the setVisible function and making the canvasView the firstResponder, my toolPicker is not showing up, and printing toolPicker.isVisible is false.

Powered by WPeMatico

You may also like...

Comments are closed.