Skip to main content
This guide walks through adding a new sync destination to HealthPush. Destinations are the core extension point — they define where health data gets sent.

Overview

Every destination implements the SyncDestination protocol:

Step-by-Step

We’ll use a hypothetical “CSV Export” destination as an example.

1. Create the Destination File

Create ios/HealthPush/Sources/Destinations/CSVExportDestination.swift:

2. Register in DestinationManager

Open ios/HealthPush/Sources/Destinations/DestinationManager.swift and register the new type so the app knows it exists:

3. Add a Setup Screen

Create ios/HealthPush/Sources/Views/Screens/CSVExportSetupScreen.swift:

4. Wire Up Navigation

In DestinationsScreen.swift, add the new destination to the “Add Destination” flow so users can select it.

5. Write Tests

Create ios/HealthPush/Tests/CSVExportDestinationTests.swift:

6. Update Documentation

  • Add the destination to the supported destinations table in README.md
  • Update the roadmap in README.md to mark it as complete

Checklist

  • SyncDestination protocol implemented
  • Registered in DestinationManager
  • Setup screen created with testConnection() UI
  • Navigation wired up in DestinationsScreen
  • Tests written and passing
  • README updated

Tips

  • Keep sync() idempotent where possible — if the destination supports it, avoid duplicating data on re-sync.
  • Always implement testConnection() meaningfully. Users rely on this to verify their setup before waiting for background syncs.
  • Use Codable conformance to persist destination configuration via SwiftData.
  • Handle network errors gracefully in sync() — throw descriptive errors so the sync engine can log useful failure reasons.