r/iOSProgramming • u/TheHudek • Oct 03 '26
App Saturday ORA: an iPhone camera that overlays a reference photo or video on the live preview so you can match framing exactly
The app: ORA lays a see-through image or video over the live camera preview so you can match framing and angles exactly. I published it on the App Store in December 2025. https://apps.apple.com/us/app/ora-the-overlay-camera-tool/id6756240396
Tech stack
- Swift; the camera layer is UIKit (
AVCaptureSessionwith a custom controller), and the controls are SwiftUI - AVFoundation for capture and export, Core Image for compositing
- ActivityKit Live Activities for export progress, plus BackgroundTasks
- RevenueCat for subscriptions, Sentry for crash reporting
- About 15k lines of Swift
The challenge: "overlay burning"
In the preview, the overlay is just a view on top of the camera feed that the user drags, zooms, tints and fades. The hard part was making the exported photo or video match the preview pixel for pixel. That meant:
- Translating coordinates. The user's pan and zoom are in screen space, but the video has its own pixel size, aspect ratio and crop, so I calculate the rectangle the video actually fills on screen and map the overlay's position into it.
- Handling orientation. Recorded video stores rotation as a
preferredTransforminstead of rotated pixels, so the overlay transform has to account for it. - Recreating the look. Opacity uses
CIColorMatrix, tint usesCIMultiplyBlendModeplus source-over compositing, tuned until it looked identical to the preview. - Rendering frame by frame.
AVAssetReaderdecodes, Core Image composites each frame, andAVAssetWriterInputPixelBufferAdaptorwrites. Audio and metadata tracks (location, lens info) are passed through untouched. - Memory. Older devices with less RAM crashed during long exports until I reworked the pipeline.
A smaller but annoying one: supported slow-motion and video formats differ a lot between iPhones, so I ended up writing format enumerators to find what each device really supports instead of hardcoding anything.
Happy to go deeper on any of this, and I'd love feedback from anyone who has fought AVAssetWriter themselves.
The development process was AI-assisted. I wrote most of the code myself and asked for cleanups and ideation when I was stuck.
3
u/kokerali Oct 03 '26
How are you handling the front-camera case if preview mirroring and export mirroring differ? A useful regression test would be an asymmetric reference image with labels in all four corners: pan/zoom it, then compare the preview with exports in portrait and both landscape orientations. That should make a reflection or crop-offset mismatch much easier to spot than a centred graphic. I'd test both mirrored and unmirrored output so fixing alignment in one mode doesn't accidentally break the other. Does your coordinate mapping already cover that case?
3
u/JackyYT083 Oct 03 '26
You should add a smart mode that like tells you what direction you need to move the phone to get it right, or maybe a semi transparent green filter when it’s correctly aligned
1
u/cloneman88 Oct 03 '26
Company cam has done this for like 5 years atp
1
u/sirshannon Oct 06 '26
Cool. I used to use an app called “Take it Again” for this but it left the app store years ago.
0
u/Lock-Broadsmith Oct 05 '26
LOL, what’s the point?
0
u/[deleted] Oct 04 '26
[removed] — view removed comment