How to initialize a PKToolPicker after iOS 14?

Xcode 12.0 beta points out the following code with a warning:
Code Block swift
let toolPiker = PKToolPicker.shared(for: UIApplication.mainWindow)
// warning: 'shared(for:)' was deprecated in iOS 14.0: Create individual instances instead.

And I tried to use the following code, but the view display without any toolPicker
Code Block swift
let toolPiker = PKToolPicker()

Same result here. Not sure on a path forward.
Try instance variable
Code Block
class ViewController: UIViewController {
private var toolPicker: PKToolPicker!


Apple Sample Code
https://developer.apple.com/documentation/pencilkit/drawing_with_pencilkit
In my case, I solved it with the following code.

Code Block swift
let toolPiker = PKToolPicker.init()

init | Apple Developer Documentation
I solved it like this
Code Block
//canvasViewDrawingDidChange add this code
toolPicker.addObserver(canvas)
toolPicker.setVisible(true, forFirstResponder: canvas)
canvas.becomeFirstResponder()



How to initialize a PKToolPicker after iOS 14?
 
 
Q