Post

Replies

Boosts

Views

Activity

Reply to Handling cancel button in SwiftUI PhotoPicker (inline)
I don't see any documentation that lets us add custom functionality to the Cancel or Add buttons when the PhotosPicker is presented inline. I built this as a workaround. NavigationStack { PhotosPicker("Choose Photos", selection: $pickerItems) .photosPickerStyle(.inline) .photosPickerDisabledCapabilities(.selectionActions) .photosPickerAccessoryVisibility(.hidden, edges: .vertical) .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Cancel") {} } ToolbarItem(placement: .topBarTrailing) { Button("Add") {} .bold() } } } The NavStack is just so we can access the nav toolbar at the top. If you're presenting this inline as a sheet, you can dismiss it from inside the Buttons.
Jul ’24