HealthLive on the App Store
iOS case study

MedicaProf

A patient health app for France and Syria: find and book doctors, join video visits, keep a medical record and sync Apple Health, in English, French and Arabic.

Client
MedicaProf · France
Role
iOS Engineer
Platform
iPhone & iPad · iOS 17+ · English, French & Arabic
Scale
~74K lines of Swift in 386 files · 8 feature modules · 2 country backends

The challenge

Give patients one app to find doctors, book and attend visits, and keep a medical record they own, while treating health data with strict privacy.

What the app does

  • Sign-in with optional two-factor codes, trusted devices that skip the code on later logins, and Face ID / Touch ID login.
  • A Home dashboard with the next appointment, profile-completion progress, Apple Health tiles and quick links.
  • Doctor search with specialty filters and recent searches, plus clinic and medical-centre pages with a map, weekly schedule and cancellation policy.
  • Step-by-step booking: choose the patient (self or a family member), the visit reason and a time slot, then review and confirm.
  • Upcoming and past appointments with details, cancellation with a reason, rescheduling and image or PDF attachments.
  • Video visits that open in the app from five minutes before the start time, with Picture in Picture.
  • A medical profile covering allergies, chronic and genetic diseases, medications, surgeries, vaccines, eye health, body metrics, blood type and smoking, with a first-run wizard and test-result trends.
  • A medical timeline of dated events with photos and PDFs, grouped by year, with a pinch-to-zoom years grid.
  • Opt-in, read-only Apple Health sync for 24 record types, with a reorderable tiles dashboard and an ECG chart.
  • Family members, added with consent and legal-representative certification, that the account holder can act on behalf of.
  • Push and live in-app notifications that open the right screen, plus in-app search across about 25 screens in three languages.

What I built

  • A feature-modular SwiftUI architecture (MVVM, Use Case, Repository, protocol-based injection) across 8 modules and ~74k lines of Swift, with two country backends and server-driven feature flags.
  • Doctor discovery and end-to-end booking (patient, visit reason, live slot availability, confirmation), cancel and reschedule, and video consultations through Jitsi with Picture in Picture.
  • A background Apple Health sync for 24 data types: anchored queries, a persisted idempotent upload queue and safe handling of revoked permissions and reinstalls.
  • Secure sessions: rotating refresh tokens with actor-based single-flight refresh, 2FA OTP with trusted devices, Face ID / Touch ID login and separate sessions for family members.
  • Privacy for health data: device-only Keychain, no medical data cached on disk, an app-switcher blur and a compile-time ban on logging.
  • An in-house design system with light and dark themes, Dynamic Type and Reduce Motion, in English, French and Arabic (RTL) with runtime language switching.
  • Push notifications (Firebase) with a WebSocket live-update channel, and TestFlight delivery with fastlane and GitHub Actions.

Under the hood

  • Single-flight token refresh: an actor makes concurrent 401 responses share one refresh, which runs on its own URLSession so it can never loop back into itself.
  • The rotated refresh token is saved to the Keychain before anything else, and a 15-second timeout with one retry lands inside the server's 30-second grace window.
  • Only a genuine authentication rejection signs the user out; offline and server errors keep the session alive.
  • Family mode sends the selected member's token on every request except account-level operations (sign-in, password, deletion, family management, Apple Health, push), which stay on the account holder.
  • HealthKit sync combines observer queries with background delivery, anchored queries that also capture deletions, and statistics queries for daily totals.
  • Health uploads go through an actor-owned queue excluded from backup, each with a SHA-256 idempotency key and server resume points; nothing is sent after a permission is revoked, so server data can't be wiped by accident.
  • One hand-written URLSession client handles JSON, form and multipart bodies, converts Arabic-Indic and Persian digits, sends the bearer token only to the app's own host and shows the backend's real error message.
  • Live notifications run over a WebSocket with 20-second pings, 2–30 second reconnect backoff and custom close codes that mean refresh-and-reconnect or stop.
  • The Jitsi web view grants camera and microphone only to the meeting's origin and reloads itself if the web content process crashes.
  • Remote feature flags let features ship dark and fall back to safe defaults when the flags can't be fetched.

Results

  • Live on the App Store.