r/iOSDevelopment • u/vivaldivevo • 1h ago
I built a live-translation camera on iOS 27 with only Apple's frameworks. Here's what bit me.
https://apps.apple.com/us/app/communicam/id6838558349CommuniCam just went live: point the camera at someone, and their words show up as captions in your language while yours reach them in theirs. It records the conversation and exports it with the subtitles in. On iPhone Duo the cover screen shows the other person the translation.
Stack
- SwiftUI, Swift 6 strict concurrency, no third-party packages
- Apple's Translation framework and on-device speech recognition
- AVFoundation multi-camera, one file per camera, combined with the subtitles on export
- Foundation Models for written summaries, StoreKit 2 for the paid tier
- Everything runs on device; the app collects no data
Things that bit me
- One preview layer per camera. iOS allows only one AVCaptureVideoPreviewLayer per camera, so every view in the app is drawn from frames instead.
- Set camera formats before startRunning. Changing a format while the session was running stalled the camera. Formats are now set once, before the session starts.
- AVFoundation setters can crash you. They throw Objective-C exceptions, which Swift can't catch; a refused exposure combination ended the app. Now it asks the is…Supported checks with the exact values, clamps to the reported ranges and sends nothing on a no.
- Finish every speech analyzer. One left behind counts against a system limit, and the next start gets refused.
- StoreKit's local test store is one per simulator. A test that leaves a purchase pending shows Apple's alert over every later launch, in every other test run. Each test now clears and settles the store first.
Happy to go deeper on any of these. And if you try the app, I'd love to hear how it holds up in a real conversation: https://apps.apple.com/us/app/communicam/id6838558349