on iOS, I want to add up undo/redo and a close button. On ipadOS, I only need to add a close button
What’s your experience in adding a close button to the ToolPicker? Or at least have the position of the window so I can add an overlapping box (even on floating).
On iOS, it is conventional to show undo/redo buttons in your app's top toolbar when the tool picker does not show them.
Check out the implementation of func updateLayout(for toolPicker: PKToolPicker)
in this sample app for more details: https://developer.apple.com/documentation/pencilkit/drawing_with_pencilkit
You may want to consider the same approach for a close button.
However, the beta releases of iOS and iPadOS 18 do support adding a custom UIBarButtonItem
to PKToolPicker
.
Check out the documentation and related WWDC video for more details:
https://developer.apple.com/documentation/pencilkit/pktoolpicker/4375528-accessoryitem