Menu

Building an iOS app blocker with the Screen Time API (FamilyControls) in Expo: what the docs don't tell you
📰

Building an iOS app blocker with the Screen Time API (FamilyControls) in Expo: what the docs don't tell you

DEV Community: swift·Daniel Yarmolenko·6 days ago
#j0KsOL2H
#devtoswift#devto#dev#shield#extension
Reading 0:00
15s threshold

I spent the last few months building Prayer Lock , an iPhone app that blocks distracting apps during a scheduled daily prayer time. The whole product rests on Apple's Screen Time API: FamilyControls , ManagedSettings and DeviceActivity . The documentation is thin and the sharp edges are real. This is the write-up I wish I had on day one.

The app is React Native (Expo) with a native Swift module, but almost everything below applies to a pure Swift app too.

The three frameworks and who does what

FamilyControls – authorization and the system app picker ( FamilyActivityPicker ). You never see bundle IDs; you get opaque ApplicationToken s.

ManagedSettings – the actual blocking. ManagedSettingsStore().shield.applications = tokens puts a system shield over those apps. Setting it to nil removes it.

DeviceActivity – schedules.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.