Added mirror toggle to webcam preview#1049
Added mirror toggle to webcam preview#1049anmolmalhotra97 wants to merge 6 commits intoTheBoredTeam:devfrom
Conversation
Introduce a mirroring toggle for CameraPreviewView. Adds an @State isMirrored (default true) and uses it to control the preview layer's horizontal scaleEffect (x: -1 or 1). Adds a bottom-right overlay button (visible only when the webcam session is running) to toggle the mirror, updates the SF Symbol based on state, and provides a help tooltip. Keeps existing layout, clipping and opacity behaviour.
Remove the .help(...) modifier from the webcam mirror/flip button in WebcamView.swift. This stops the hover tooltip (which used localization keys) from appearing and simplifies the UI; no other behaviour changes were made.
|
Hi @Alexander5015 , Please review this PR and let me know if you have any recommendations. |
| } | ||
| } | ||
| } | ||
| // The mirror toggle button should only be visible if the webcam session is running |
There was a problem hiding this comment.
I think we can make this a setting in Settings, unless you believe there’s a strong case for keeping it here.
There was a problem hiding this comment.
| // Track if authorization request is in progress to avoid multiple requests | ||
| @State private var isRequestingAuthorization: Bool = false | ||
| // Track the current state of mirror effect and the mirror icon in camera preview | ||
| @State private var isMirrored: Bool = true |
There was a problem hiding this comment.
This should be stored in Defaults to make it persistent
There was a problem hiding this comment.
I have updated the code to cater to this suggestion.
- Rename WebcamSettings to WebcamSettingsView and register it in the Xcode project. - Introduce an enableFlipWebcamToggle UI flow: switch to using Defaults. - Toggle in the settings, show/hide a mirror button in the camera preview only when the toggle is enabled and the session is running, and improve the mirror button icon and styling. - Rename the Defaults key mirrorWebcam to isMirrored (default false) and update usages. - Add localization entries for the new toggle and the Webcam label and bump Localizable.xcstrings version. - Update project.pbxproj to include the new/renamed source file references.
|
@Alexander5015, I have updated the codebase as per your suggestions. Please review and provide feedback. |
There was a problem hiding this comment.
Move all mirror settings here. I think its the setting to enable the mirror and the mirror shape.
| NavigationLink(value: "Shelf") { | ||
| Label("Shelf", systemImage: "books.vertical") | ||
| } | ||
| NavigationLink(value: "Webcam") { |
There was a problem hiding this comment.
Rename to Mirror to match the feature name
|
|
||
| // Track the current state of mirror effect and the mirror icon in camera preview | ||
| @Default(.isMirrored) private var isMirrored | ||
| @Default(.enableFlipWebcamToggle) private var enableFlipWebcamToggle |
There was a problem hiding this comment.
I am open to discussion about this, but I don't think we need a toggle button overlay at all. My suggestion was that rather than having a visible toggle button, we just make this a setting in settings as I don't think this will be frequently changed.
There was a problem hiding this comment.
This is an autogenerated file and should not be updated (by you or by AI). Discard the changes in this file and rebuild the app to allow Xcode to generate these keys.
| } | ||
| }, | ||
| "version" : "1.0" | ||
| "version" : "1.1" |
There was a problem hiding this comment.
This is the Strings Catalog format version and shouldn't be modified.

Add Mirror Toggle to Webcam Preview
Introduced a mirroring toggle feature for the CameraPreviewView.
What was changed: -
Why was it changed:-
Related Issues
Label: Enhancement -> #1002
Screenshots / Screen Recordings
Screen.Recording.2026-02-24.at.01.07.29.mov
Screen Recording








Notch Open
Webcam Mode
Flip button not visible in the webcam feed, since disabled in webcam settings
Flip button is visible in the webcam feed, since enabled in the webcam settings
Normal Webcam (Non-flipped/mirrored)
Note: Bottom right corner has a flip/mirror button
Flipped Webcam Feed
Regular Webcam Feed (click to Flip Button)
Mirrored Webcam Feed (click to return to normal)