I recently built a small iPhone app called FocusLock.
The idea is simple: choose distracting apps, create a rule, and let the phone enforce the boundary when it is time to focus.
I built it because I kept running into the same problem with my own phone habits. I did not need a bigger productivity system. I needed fewer tiny negotiations with myself.
This post is mostly about the technical side: what it is like to build this kind of app on iOS, what Apple gives you through the Screen Time APIs, and the tradeoffs I ran into while building the first version.
The main frameworks
FocusLock is built around a few Apple frameworks:
FamilyControls
ManagedSettings
DeviceActivity
UserNotifications
SwiftUI
At a high level:
FamilyControls lets the user choose apps or app categories through Apple's system picker.
ManagedSettings lets the app apply shields to the selected apps/categories.
DeviceActivity lets the system wake an extension when a scheduled interval starts or ends.
The important detail is that…