Hi I would like to show the PhotosPicker
programatically the same way we can do with sheet(isPresented: Binding<Bool>)
and fullScreenCover(isPresented: Binding<Bool>)
, i.e. I would like:
photosPicker(isPresented: Binding<Bool>, selectedItem: Binding<PhotosPickerItem?>)
.
This would allow me to have multiple buttons that show the picker and would make all my code that shows sheets consistent, thanks for reading.
There is already a modifier for this. It has the same parameters as the PhotosPicker
view and comes in its different variants.
photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:) -> some View
I couldn't find it in the documentation, but you can find it in Xcode's generated interface for SwiftUI.