I am using UIViewControllerRepresentable in my SwiftUI project to embed the native iOS camera interface. I want to add a grid overlay on the camera preview to assist users with photo composition. At the same time, I want to retain the native iOS camera features such as switching between the front and rear cameras and the shutter button.
So far, I know how to add a grid using CAShapeLayer, but I’m not sure how to integrate this overlay while keeping the native camera interface fully functional.
Specifically, I’m looking to:
Display a grid overlay on the camera preview.
Keep the native iOS camera interface and functionality (e.g., switching between cameras, taking photos, etc.).
I have embedded a custom UIViewController using UIViewControllerRepresentable and attempted to draw the grid overlay on top of it. However, I am unsure how to preserve the native camera UI elements and features while doing this.
I was expecting to find a way to combine the grid overlay with the standard iOS camera interface, but I haven’t figured out how to approach it.
Any advice or code examples would be appreciated. Thank you!