Journal

Apple HealthKit Step Counter in SwiftUI (Free Template)

A step counter is easy to draw and easy to get wrong: the real work is asking for HealthKit permission properly and being honest that it is not medical advice.

Apple HealthKit Step Counter in SwiftUI (Free Template): a vivid neon 3D App Store icon on an orange, pink and blue gradient

TL;DR

A HealthKit step counter in SwiftUI requests permission to read step data, shows today's steps against a goal, and charts the trend over the week with Swift Charts. The hard parts are not the UI: request only the data you need, handle the case where permission is denied, read from HealthKit rather than counting steps yourself, and be clear that the app is a fitness aid, not a medical device. Build the UI from a free VP0 design and keep health data private.

Want a step counter that reads real Apple Health data in SwiftUI? The short answer: request HealthKit permission for steps, query today’s count and the week’s trend, and show them against a goal with Swift Charts. The UI is the easy half. The half that matters is asking for permission correctly, handling a refusal gracefully, and being honest that this is a fitness aid, not medicine. Build the UI from a free VP0 design, the free iOS design library for AI builders, and keep the data private.

Who this is for

This is for builders of fitness, wellness, and activity apps who want accurate step data from the system rather than a homemade pedometer, and who want to handle health permissions and honesty the right way.

How a HealthKit step counter works

You do not count steps yourself; the device already does, and HealthKit is the shared, privacy-protected store you read from. The flow is: request read authorization for the step-count type, query today’s total and the last several days, and render them. Crucially, HealthKit authorization is granular and private, so the app may not know whether the user granted or denied access, and you must design for the empty or denied case rather than assuming data will arrive. Apple’s guide to authorizing access to health data explains the permission model, and Swift Charts turns the daily totals into a clean trend.

PieceToolGet it right
PermissionHealthKit authorizationRequest only steps, clear usage string
Today’s stepsHealthKit queryA ring or big number against a goal
Weekly trendSwift ChartsHonest scale, no cherry-picking
Denied stateGraceful fallbackApp still works without data
PrivacyOn-device dataNever sell or leak health data

Build it free with a VP0 design

Pick a fitness or activity design from VP0, copy its link, and prompt your AI builder:

Rebuild this VP0 fitness design in SwiftUI with HealthKit: [paste VP0 link]. Request read access to step count with a clear usage description, show today’s steps against a goal as a ring, and chart the last seven days with Swift Charts. Handle the case where permission is denied so the app still works, and keep all health data on device.

Movement matters: the World Health Organization notes that physical inactivity is a leading risk factor, and while the popular 10,000-step target is a motivational round number rather than a medical prescription, a clear tracker genuinely helps people move more. For neighboring hardware and habit patterns, see Core NFC and Tap to Pay for AI-built apps, a Bluetooth device pairing UI in SwiftUI, an equine horse-riding speed tracker, and a habit tracker source code. When your app needs to scan inventory or codes, see a warehouse inventory scanner app in React Native.

Privacy and honesty

Health data is among the most sensitive a person has, so treat it that way. Request only what you use, keep it on device where you can, and never sell or quietly transmit it. Equally important, set expectations: a step counter is a wellness and fitness aid, not a medical device or a diagnosis. Say so plainly in the app. The honest framing protects your users and keeps you clear of regulated-medical territory you did not intend to enter.

Common mistakes

The first mistake is counting steps yourself instead of reading the accurate system data from HealthKit. The second is requesting more health data than you use. The third is assuming permission was granted and breaking when it was not. The fourth is implying medical accuracy or diagnosis. The fifth is paying for a fitness kit when a free VP0 design plus HealthKit and Swift Charts does it.

Key takeaways

  • Read steps from HealthKit; do not build your own pedometer.
  • Request only the data you use, with a clear usage description.
  • Design for the denied or empty state so the app still works.
  • Keep health data private and call the app a fitness aid, not medical.
  • Build the UI free from a VP0 design.

Frequently asked questions

How do I build a HealthKit step counter in SwiftUI? Request read access to step count, query today’s steps and the recent daily totals, show them against a goal, and chart the trend with Swift Charts, handling denied permission gracefully.

What is the safest way to build a HealthKit app with Claude Code or Cursor? Start from a free VP0 design, request only the data you need with a clear usage string, handle the denied state, keep data private, and call it a fitness aid, not medical.

Can VP0 provide a free SwiftUI or React Native template for a fitness app? Yes. VP0 is a free iOS design library; pick a fitness design and your AI tool rebuilds the step ring, trend chart, and goal UI at no cost.

Is a HealthKit step counter a medical device? No. It is a general fitness and wellness aid, not a regulated medical device, and you should say so rather than presenting steps as medical advice.

Frequently asked questions

How do I build a HealthKit step counter in SwiftUI?

Request read authorization for step count, query HealthKit for today's steps and the recent daily totals, and show them against a goal with a Swift Charts trend. Read from HealthKit rather than counting steps yourself, handle denied permission gracefully, and never block the app if the user declines access.

What is the safest way to build a HealthKit app with Claude Code or Cursor?

Start from a free VP0 design and request only the specific health data you need, with a clear usage description. Handle the denied state, keep health data private and on device where possible, and state plainly that the app is a fitness aid, not a medical device or diagnosis.

Can VP0 provide a free SwiftUI or React Native template for a fitness app?

Yes. VP0 is a free iOS design library for AI builders. Pick a fitness or activity design, copy its link, and your AI tool rebuilds the step ring, trend chart, and goal UI at no cost while HealthKit provides the data.

Is a HealthKit step counter a medical device?

No. A step counter built on HealthKit is a general fitness and wellness aid, not a regulated medical device, and you should say so. Do not present step data as medical advice or diagnosis, and if your app moves toward clinical claims, that is a different and regulated path.

Part of the Native Hardware, Sensors & Device Features hub. Browse all VP0 topics →

Keep reading

Bluetooth Device Pairing UI in SwiftUI (Free Template): the App Store logo as a glossy glass icon on a purple and blue gradient with floating bubbles
Guides 4 min read

Bluetooth Device Pairing UI in SwiftUI (Free Template)

A BLE pairing screen scans, lists nearby devices, and walks through connecting with clear states. Build it with Core Bluetooth from a free VP0 design.

Lawrence Arya · May 31, 2026
SwiftUI NFC Reader with a Bottom Sheet Result: a glass app tile showing the VP0 logo on a pink and blue gradient
Guides 4 min read

SwiftUI NFC Reader with a Bottom Sheet Result

A free SwiftUI pattern for reading NFC tags with Core NFC and showing the result in a native bottom sheet, plus the entitlement and the tags-not-cards truth.

Lawrence Arya · June 1, 2026
Core NFC and Tap to Pay for AI-Built iOS Apps: a glowing iPhone home-screen icon on a purple and blue gradient
Guides 5 min read

Core NFC and Tap to Pay for AI-Built iOS Apps

Can an AI-generated app read a physical credit card over NFC and charge it? The honest answer, plus the right way to accept a tap, built from a free VP0 design.

Lawrence Arya · May 31, 2026
iPhone LiDAR Room Scanner UI Template (SwiftUI + RoomPlan): the App Store logo on a glass tile over a blue gradient with bubbles
Guides 4 min read

iPhone LiDAR Room Scanner UI Template (SwiftUI + RoomPlan)

Build a LiDAR room scanner UI in SwiftUI with RoomPlan: a guided scan, live coaching, and a 3D result, from a free VP0 design. With a graceful non-LiDAR fallback.

Lawrence Arya · May 31, 2026
watchOS AI Agent Widget Template (SwiftUI): a glass iPhone app-grid icon on a mint and teal gradient
Guides 4 min read

watchOS AI Agent Widget Template (SwiftUI)

Build an AI agent companion for Apple Watch in SwiftUI: a glanceable complication, quick actions, and a wrist-sized reply, from a free VP0 design.

Lawrence Arya · May 31, 2026
CarPlay Audio Player Template for iOS, Free: a glass iPhone UI wireframe icon on a holographic purple gradient
Guides 5 min read

CarPlay Audio Player Template for iOS, Free

Build a CarPlay audio player for iOS from a free template. Use CarPlay's list and now-playing templates the right way with Claude Code or Cursor.

Lawrence Arya · June 1, 2026