```html How to Build a Running Tracker App in SwiftUI (2026)

How to Build a Running Tracker App in SwiftUI

A Running Tracker app records GPS routes, live pace, and workout metrics so athletes can review every run in detail. It's perfect for indie developers who want a health-focused app with strong recurring revenue potential on the App Store.

iOS 17+ · Xcode 16+ · SwiftUI Complexity: Intermediate Updated: 2026-05-12

Prerequisites

Steps

1. Define the Run data model with SwiftData

Create a @Model class so every finished run is persisted automatically by SwiftData and survives app restarts.

import SwiftData
import CoreLocation

@Model
final class Run {
    var id: UUID = UUID()
    var date: Date = Date()
    var distanceMeters: Double = 0
    var durationSeconds: Double = 0
    var routeData: Data = Data()   // encoded [CLLocationCoordinate2D]

    var paceSecondsPerKm: Double {
        guard distanceMeters > 0 else { return 0 }
        return durationSeconds / (distanceMeters / 1000)
    }
}

2. Build the run summary UI with Charts

Use SwiftUI Charts to render a pace-per-kilometre bar chart so runners can see where they sped up or slowed down.

import SwiftUI
import Charts

struct RunSummaryView: View {
    let run: Run
    let splits: [Split]   // computed from routeData

    var body: some View {
        VStack(alignment: .leading, spacing: 16) {
            Text(run.date, style: .date).font(.title2.bold())
            Chart(splits) { split in
                BarMark(
                    x: .value("KM", split.kilometre),
                    y: .value("Pace (s/km)", split.paceSeconds)
                )
                .foregroundStyle(.green)
            }
            .frame(height: 180)
            HStack {
                StatTile(label: "Distance", value: String(format: "%.2f km", run.distanceMeters / 1000))
                StatTile(label: "Avg Pace",  value: formattedPace(run.paceSecondsPerKm))
            }
        }
        .padding()
    }
}

3. Implement GPS route and pace tracking with CoreLocation

Stream CLLocation updates through a Swift @Observable manager to accumulate distance and compute rolling pace in real time.

import CoreLocation
import Observation

@Observable
final class RunSession: NSObject, CLLocationManagerDelegate {
    private let manager = CLLocationManager()
    var locations: [CLLocation] = []
    var distanceMeters: Double = 0

    func start() {
        manager.delegate = self
        manager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
        manager.activityType = .fitness
        manager.requestWhenInUseAuthorization()
        manager.startUpdatingLocation()
    }

    func locationManager(_ manager: CLLocationManager,
                         didUpdateLocations newLocs: [CLLocation]) {
        guard let latest = newLocs.last else { return }
        if let prev = locations.last {
            distanceMeters += latest.distance(from: prev)
        }
        locations.append(latest)
    }
}

Common Pitfalls

Monetization with Subscriptions

A Running Tracker is a natural fit for an auto-renewable subscription — offer a free tier limited to the last five runs, then unlock unlimited history, advanced pace analytics, and HealthKit export under a monthly or annual plan using StoreKit 2. Present your paywall with SubscriptionStoreView (available from iOS 17) so the system handles purchase, restoration, and Family Sharing automatically, keeping your StoreKit integration lightweight and App Store Review–compliant.

Ship Faster with Soarias

Scaffolding CoreLocation permissions, HealthKit entitlements, SwiftData migrations, and StoreKit paywalls from scratch typically costs two or three days of boilerplate work. Soarias generates the complete Xcode project locally — models, entitlements, StoreKit configuration file, and fastlane lanes — so you can jump straight to building the features that make your Running Tracker unique and cut your time-to-TestFlight down to an afternoon.

Related Tutorials

FAQ

Do I need an Apple Developer account to build this app?

You can run the app on a personal device for free using Xcode's free provisioning, but HealthKit entitlements and App Store distribution require a paid Apple Developer Program membership ($99/year).

How do I submit my Running Tracker to the App Store?

Archive your app in Xcode (Product → Archive), then use the Organizer to upload to App Store Connect. Complete your app's metadata, screenshots, and privacy nutrition labels in App Store Connect, then submit the build for review — Apple typically reviews within 24–48 hours.

Last reviewed: 2026-05-12 by the Soarias team.

```