Ios SwiftUI中的工作表侦听器

Ios SwiftUI中的工作表侦听器,ios,swiftui,Ios,Swiftui,我用纸张从图库中选取图像。我想在选择图像后调用函数(uploadToServer()) 我的代码: sheet(isPresented: $isImagePickerShown) { ImagePickerController(sourceType: self.sourceType, inputImage: self.$image, inputImageUrl: $imageURL) //I want to get the selected imageURL

我用纸张从图库中选取图像。我想在选择图像后调用函数(uploadToServer())

我的代码:

sheet(isPresented: $isImagePickerShown) {
        ImagePickerController(sourceType: self.sourceType, inputImage: self.$image, inputImageUrl: $imageURL)
          //I want to get the selected imageURL here to call uploadToServer()
    }

工作表被删除后如何获取url?

在回调中使用它,如

sheet(isPresented: $isImagePickerShown, onDismiss: {
   // use `self.imageURL` here to upload to server
   uploadToServer(url: self.imageURL)   // << eg.
}) {
        ImagePickerController(sourceType: self.sourceType, inputImage: self.$image, inputImageUrl: $imageURL)
          //I want to get the selected imageURL here to call uploadToServer()
    }
工作表(显示:$isImagePickerShown,onDismiss:{
//在此处使用“self.imageURL”上载到服务器
uploadToServer(url:self.imageURL)//