How doyeonjeong/screentimeapi-example works
This iOS Screen Time example lets a user authorize access, select apps, apply shielding, and later clear it. The README documents this workflow; sampled Swift sources confirm the view/controller, shared selection model, and enforcement calls. System APIs are shown as external services; no separate persistence layer is evident.
Main entry points: ViewController.swift View controller · YouTubeBlocker.swift App blocker · SwiftUIView.swift Picker view · BlockingApplicationModel.swift Selection model
Components 10
App interface
- Scene setup
ScreenTimeAPIExample/ScreenTimeAPIExample/Application/SceneDelegate.swift - View controller
ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift - Picker view
ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift
App selection
- Selection model
ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift
Screen Time enforcement
- App blocker
ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift
Other components
- User
- Family activity picker
- Authorization center
- Managed settings
- Device activity
Connections 11
- Scene setup → View controller: creates
- View controller → Picker view: hosts
- User → Picker view: selects apps
- Picker view → Family activity picker: presents
- Family activity picker → Selection model: updates selection
- View controller → Authorization center: requests access
- User → View controller: taps controls
- View controller → App blocker: calls block or unblock
- App blocker → Selection model: reads tokens
- App blocker → Managed settings: sets shield
- App blocker → Device activity: starts monitoring