Just to add my current attempt is (It shows the picker, but when you dismiss it, you need to dismiss the extra, dummy, view controller too):
import Foundation
import SwiftUI
import Photos
import PhotosUI
struct TestView: View {
@State var showLibraryPicker = false
var body: some View {
NavigationView {
VStack {
Button("Open Library Picker") { showLibraryPicker = true }
}
.navigationBarTitle("Test", displayMode: .inline)
.navigationViewStyle(StackNavigationViewStyle())
.sheet(isPresented: $showLibraryPicker, onDismiss: { print("Dismissed") }) {
TestLimitedLibraryPicker()
}
}
}
}
struct TestLimitedLibraryPicker: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
let controller = UIViewController()
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: controller)
return controller
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}