Inspiration

I'd pick up my phone to check one thing and look up 40 minutes later. Screen time limits never worked for me because I'd just tap "ignore." So I wanted something that made me earn it.

What it does

StepLock locks the apps you pick until you walk. Every 100 steps = 1 minute of screen time. When you need your apps, you spend minutes and a timer starts. When it runs out, they lock again, even if StepLock is closed.

There's also a daily challenge: find something outside (like "something yellow"), take a photo of it, and get 15 bonus minutes. Everyone gets the same challenge each day.

How I built it

SwiftUI for the app, CoreMotion for steps, and Apple's Screen Time frameworks (FamilyControls, ManagedSettings, DeviceActivity) for locking apps. A small DeviceActivity extension re-locks apps in the background. The photo check runs on a Cloudflare Worker so no keys live in the app.

Challenges I ran into

  • Screen Time doesn't work in the Simulator, so I had to test on my real phone a lot.
  • Getting apps to re-lock while StepLock is closed. Screen Time schedules have to be at least 15 minutes long, so I had to work around that.
  • Making the photo check fair. I cut challenges that didn't make sense (like "the sky") and tested it against a bunch of photos until it was consistent.
  • The app was laggy on my phone at first. I profiled it and fixed what was redrawing too often.

Accomplishments that I'm proud of

It actually works on a real iPhone. My apps really lock, and the only way to unlock them is to go for a walk.

What I learned

How Apple's Screen Time APIs work, how to profile a SwiftUI app on a real device, and that small details (like a smooth countdown) make a big difference in how an app feels.

What's next for StepLock

  • Streaks and weekly stats
  • Doing the daily challenge with friends
  • App Store release

Built With

Share this project:

Updates

Submission history