How to create .drawing file for PencilKit?

I would like to ask if I have the following code :

import PencilKit
import SwiftUI

struct ContentView : View{
 var canvas = PKCanvasView()
 var picker = PKToolPicker()

 var body: some View{

    MyPencilView(canvas : canvas, picker: picker)

 }
}



struct MyPencilView: UIViewRepresentable{
    var canvas: PKCanvasView
    let picker: PKToolPicker

    func makeUIView(context: Context) -> some UIView {
        picker.setVisible(true, forFirstResponder: canvas)
        picker.addObserver(canvas)
        canvas.becomeFirstResponder()
       
        return canvas
    }
    
    func updateUIView(_ uiView: UIViewType, context: Context) {
        
    }
}

Where should I add dataRapresentation() to save the . drawing file in the asset folder?

Thanks in advance

Please see the PKDrawing class: PencilKit: PKDrawing https://developer.apple.com/documentation/pencilkit/pkdrawing

use the PKCanvasView's property 'drawing' to save/restore this data: PencilKit: PKCanvasView: drawing https://developer.apple.com/documentation/pencilkit/pkcanvasview/3229950-drawing then you can save that data somewhere (perhaps in a file).

Use the PKCanvasView to do the drawing when you want to display your PKDrawing data. PencilKit: PKCanvasView https://developer.apple.com/documentation/pencilkit/pkcanvasview

Here is a PencilKit sample that makes use of the PKDrawing data: PencilKit: Inspecting, Modifying, and Constructing PencilKit Drawings https://developer.apple.com/documentation/pencilkit/inspecting_modifying_and_constructing_pencilkit_drawings

How to create .drawing file for PencilKit?
 
 
Q