Commit 20c0fc5
committed
FoodFinder camera: native-style overlay with library thumbnail
Polish the in-app camera so it feels like the iOS native Camera app
and consolidates the two-button "Take a Photo / Choose from Library"
entry point into a single capture surface.
Camera overlay (FoodFinder_CameraOverlay):
- Library-thumbnail button on the bottom-left auto-loads the user's
most recent photo via PhotoKit (with the new NSPhotoLibraryUsageDescription
prompt; falls back to a generic SF Symbol if denied). Tap flips the
picker into .photoLibrary mode in place.
- Flip-camera button bottom-right uses the iOS-native circular-arrows
glyph (arrow.triangle.2.circlepath) in a circular chip.
- Shutter unchanged in position; thumb + flip dropped to the bottom of
the translucent band (the native camera does the same — auxiliary
controls sit at the floor while the shutter stays elevated).
- Semi-transparent black band behind the controls.
- Camera preview scales + translates to fill the entire screen via
cameraViewTransform so the translucent band shows actual preview
content through it, not picker.view's solid black background. The
captured frame is unaffected (still the full 4:3 sensor image).
- All positioning happens in layoutSubviews against self.bounds —
fixed shutter / thumbnail / flip being clipped off-screen when the
overlay's rendered bounds differed from UIScreen.main.bounds.
- showsCameraControls and cameraOverlayView are only touched when
sourceType == .camera. Setting them on a .photoLibrary picker froze
the OS picker.
Image crop view (FoodFinder_ImageCropView):
- Drop the inner NavigationView. The host AICameraView's outer nav bar
now holds both Cancel (left) and a conditional "Reset Crop" (right)
on the same row instead of two stacked toolbars.
- Reset is driven by an integer `resetTrigger` binding the host
increments — the crop view observes via .onChange.
AI Food Analysis host (AICameraView):
- "AI Food Analysis" title removed.
- "Choose from Library" button removed; library entry is now the
overlay's thumbnail.
- Conditional Reset Crop ToolbarItem renders Button vs EmptyView
inside the ToolbarItem body — `if` directly inside `.toolbar`
needs ToolbarContentBuilder.buildIf which is iOS 16+.
Strings: Info.plist gains NSPhotoLibraryUsageDescription. xcstrings
catalogs auto-synced by Xcode.1 parent 6921e37 commit 20c0fc5
5 files changed
Lines changed: 312 additions & 117 deletions
File tree
- Loop
- Views/FoodFinder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1146 | 1146 | | |
1147 | 1147 | | |
1148 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1149 | 1161 | | |
1150 | 1162 | | |
1151 | 1163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6569 | 6569 | | |
6570 | 6570 | | |
6571 | 6571 | | |
6572 | | - | |
6573 | | - | |
6574 | | - | |
6575 | 6572 | | |
6576 | 6573 | | |
6577 | 6574 | | |
| |||
11152 | 11149 | | |
11153 | 11150 | | |
11154 | 11151 | | |
11155 | | - | |
| 11152 | + | |
11156 | 11153 | | |
11157 | 11154 | | |
11158 | 11155 | | |
| |||
13328 | 13325 | | |
13329 | 13326 | | |
13330 | 13327 | | |
13331 | | - | |
13332 | | - | |
13333 | | - | |
13334 | 13328 | | |
13335 | 13329 | | |
13336 | 13330 | | |
| |||
15399 | 15393 | | |
15400 | 15394 | | |
15401 | 15395 | | |
15402 | | - | |
15403 | | - | |
15404 | | - | |
15405 | | - | |
15406 | 15396 | | |
15407 | 15397 | | |
15408 | 15398 | | |
| |||
35631 | 35621 | | |
35632 | 35622 | | |
35633 | 35623 | | |
| 35624 | + | |
| 35625 | + | |
| 35626 | + | |
35634 | 35627 | | |
35635 | 35628 | | |
35636 | 35629 | | |
| |||
0 commit comments