Commit c974e79
committed
Fix: add Cancel button to photo picker on macOS when Photos library is empty
When the Photos library is empty on macOS (Catalyst), PHPickerViewController
renders no close/cancel button and ignores Esc/Cmd+Q, leaving the user unable
to dismiss the picker without force-quitting the app (issue #507).
Fix: after presenting the picker, inject a UIBarButtonItem(.cancel) into its
navigationItem.leftBarButtonItem under #if targetEnvironment(macCatalyst).
Tapping it dismisses the picker and calls the completion handler with nil,
matching the existing behaviour for a cancelled pick.
Fixes #5071 parent 4dc000d commit c974e79
1 file changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
31 | 51 | | |
| 52 | + | |
32 | 53 | | |
33 | 54 | | |
34 | 55 | | |
| |||
0 commit comments