Swift 该函数在UIViewControllerRepresentable中不起作用

Swift 该函数在UIViewControllerRepresentable中不起作用,swift,uiviewcontroller,swiftui,Swift,Uiviewcontroller,Swiftui,我试图通过UIViewControllerRepresentable在SwiftUI中实现该组件。视图成功启动,但未刷新的photopicker函数不起作用,它总是返回nil,有人能告诉我问题出在哪里吗 import SwiftUI import UnsplashPhotoPicker struct UnsplashImagePicker: UIViewControllerRepresentable { var urlUnsplashImage = [UnsplashPhoto]()

我试图通过UIViewControllerRepresentable在SwiftUI中实现该组件。视图成功启动,但未刷新的photopicker函数不起作用,它总是返回nil,有人能告诉我问题出在哪里吗

import SwiftUI
import UnsplashPhotoPicker

struct UnsplashImagePicker: UIViewControllerRepresentable {

    var urlUnsplashImage = [UnsplashPhoto]()

    let configuration = UnsplashPhotoPickerConfiguration(
      accessKey: "f99d21d6eb682196455dd29b621688aff2d525c7c3a7f95bfcb05d497f38f5dc",
      secretKey: "ccff858162e795c062ce13e9d16a2cf607076d0eb185141e35b14f589b1cd713",
      allowsMultipleSelection: false)

    func makeUIViewController(context: UIViewControllerRepresentableContext<UnsplashImagePicker>) -> UnsplashPhotoPicker {
        let unsplashImagePicker = UnsplashPhotoPicker(configuration: configuration)
        unsplashImagePicker.delegate = context.coordinator
        return unsplashImagePicker
    }

    func makeCoordinator() -> UnsplashImagePicker.Coordinator {
        Coordinator(self)
    }

    class Coordinator: NSObject, UnsplashPhotoPickerDelegate, UINavigationControllerDelegate {
        var parent: UnsplashImagePicker
        init(_ parent: UnsplashImagePicker) {
            self.parent = parent
        }

        func unsplashPhotoPicker(_ photoPicker: UnsplashPhotoPicker, didSelectPhotos photos: [UnsplashPhoto]) {
            print(photos)
        }

        func unsplashPhotoPickerDidCancel(_ photoPicker: UnsplashPhotoPicker) {
            print("Unsplash photo picker did cancel")
        }
    }

    func updateUIViewController(_ uiViewController: UnsplashPhotoPicker, context: UIViewControllerRepresentableContext<UnsplashImagePicker>) {

    }
}
导入快捷界面
进口光电采集器
结构UnplashImagePicker:UIViewControllerRepresentable{
var urlUnsplashImage=[unplashphoto]()
let配置=未刷新的光选择器配置(
accessKey:“f99d21d6eb682196455dd29b621688aff2d525c7c3a7f95bfcb05d497f38f5dc”,
秘钥:“ccff858162e795c062ce13e9d16a2cf607076d0eb185141e35b14f589b1cd713”,
allowsMultipleSelection:false)
func makeUIViewController(上下文:UIViewControllerRepresentableContext)->UnflashPhotoPicker{
让unplashImagePicker=unplashPhotoPicker(配置:配置)
unplashImagePicker.delegate=context.coordinator
返回图像选择器
}
func makeCoordinator()->unplashImagePicker.Coordinator{
协调员(自我)
}
类协调器:NSObject、unflashphotopickerdelegate、UINavigationControllerDelegate{
var父项:图像选择器
init(uu父项:unplashImagePicker){
self.parent=parent
}
func unplashphotopicker(photoPicker:unplashphotopicker,didSelectPhotos照片:[unplashphoto]){
印刷品(照片)
}
func unplashphotopickerdidconcel(photoPicker:unplashphotopicker){
打印(“未刷新的照片选择器已取消”)
}
}
func updateUIViewController(uViewController:UnplashPhotoPicker,上下文:UIViewControllerRepresentableContext){
}
}