# doyeonjeong/screentimeapi-example architecture

> Architecture diagram of the GitHub repository doyeonjeong/screentimeapi-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doyeonjeong/screentimeapi-example
- Repository: https://github.com/doyeonjeong/screentimeapi-example

## Overview

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: [`ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift`](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift) (View controller), [`ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift`](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift) (App blocker), [`ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift`](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift) (Picker view), [`ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift`](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift) (Selection model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["App interface"]
  node_scene["Scene setup"]
  node_controller["View controller"]
  node_view["Picker view<br/>[SwiftUIView.swift]"]
end

subgraph group_selection["App selection"]
  node_model["Selection model"]
end

subgraph group_enforcement["Screen Time enforcement"]
  node_blocker["App blocker"]
end

node_user(("User"))
node_picker["Family activity picker"]
node_authorization["Authorization center"]
node_settings["Managed settings"]
node_activity["Device activity"]

node_scene -->|"creates"| node_controller
node_controller -->|"hosts"| node_view
node_user -->|"selects apps"| node_view
node_view -->|"presents"| node_picker
node_picker -->|"updates selection"| node_model
node_controller -->|"requests access"| node_authorization
node_user -->|"taps controls"| node_controller
node_controller -->|"calls block or unblock"| node_blocker
node_blocker -->|"reads tokens"| node_model
node_blocker -->|"sets shield"| node_settings
node_blocker -->|"starts monitoring"| node_activity

click node_scene "https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Application/SceneDelegate.swift"
click node_controller "https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift"
click node_view "https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift"
click node_model "https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift"
click node_blocker "https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scene,node_controller,node_view,node_user toneBlue
class node_model toneAmber
class node_blocker toneMint
class node_picker,node_authorization,node_settings,node_activity toneIndigo
```

## Components

### App interface

- [Scene setup](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Application/SceneDelegate.swift): `ScreenTimeAPIExample/ScreenTimeAPIExample/Application/SceneDelegate.swift`
- [View controller](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift): `ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/ViewController.swift`
- [Picker view](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift): `ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/SwiftUIView.swift`

### App selection

- [Selection model](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift): `ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/BlockingApplicationModel.swift`

### Screen Time enforcement

- [App blocker](https://github.com/doyeonjeong/screentimeapi-example/blob/main/ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift): `ScreenTimeAPIExample/ScreenTimeAPIExample/Sources/YouTubeBlocker.swift`

### Other components

- **User**
- **Family activity picker**
- **Authorization center**
- **Managed settings**
- **Device activity**

## Connections

- 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
