Skip to content

This project explores the capabilites of the iOS 16 Screen Time API which is composed of three frameworks: Managed Settings, Family Controls, Device Activity

Notifications You must be signed in to change notification settings

christianp-622/ScreenBreak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 

Repository files navigation

ScreenBreak

Project Logo

ScreenBreak offers advanced ScreenTime restrictions and monitoring. This project explores the capabilites of the iOS 16 Screen Time API.

Table of Contents

  1. Project Overview
  2. Frameworks and Extensions
  3. Package Dependencies
  4. Demo
  5. Acknowledgment
  6. Roadmap

Project Overview

The goal of this project was to leverage Apple’s Screen Time APIs (DeviceActivity, ManagedSettings, FamilyControls) to give users two capabilities:

  • Usage insights – clear, daily analytics on which apps and categories consume the most time.
  • Self-lock – let users “shield” any app for a user-defined interval, helping them stay accountable and reduce distractions.

On first launch, the app requests the necessary privileges through AuthorizationCenter (FamilyControls) so each user can grant personal control—made possible by new individual-authorization rules introduced at WWDC 22.

Frameworks and Extensions

SwiftUI

We utilize the SwiftUI framework, which provides a modern and intuitive way to create a visually pleasing user interface.

Device Acitivity Report Extension

Retrieves per-user analytics by mapping:

Token Type Represents
ActivityToken A single app
CategoryToken An Apple-defined category (e.g., Social, Productivity)
WebDomainToken A specific web domain

Captured metrics include:

  • Notification count per app
  • Pick-up count per app (times the device is woken)
  • Category for each app or domain
  • Screen-time totals per app and per category
  • Time of first pick-up each day

Family Controls

Leveraged the FamilyActivityPicker (from FamilyControls) to present users with a complete list of apps, categories, and web domains installed on their device. The flow is:

  • User selects items in the picker (multiple choice).
  • A view-model converts those choices into a persisted FamilyActivitySelection.

The stored selection is used by the Managed Settings layer to

  • apply shields—temporarily blocking the chosen apps, categories, or domains, and
  • lift shields on demand or when the timer expires.

This pattern cleanly separates UI, state management, and policy enforcement while giving users granular control over their own distractions.

Device Activity Monitor Extension

The Device Activity Monitor enables us to lift a shield, allowing us to create multiple shield time intervals instead of a singular option.

Sheild Cofiguration Extension

This extension allows us to create a custom shield with our logo and personalized message on it.

Widget Extension

The Widget Extension allows us to create a custom widget for our application. According to Apple's guidelines, the widget should provide glanceable information and stay up to date with your application. Our widget shows whether the user is in restriction mode or not, and displays the time at which their restriction mode will be lifted (if they are in restriction mode). To enable communication between the extension and the main app, we created an app group, providing a line of communication between the widget and the main app.

Package Dependencies

RiveRuntime

RiveRuntime enables us to implement an animated navigation bar for seamless navigation throughout our app. Additionally, it provides a beautifully animated background for our onboarding screen. We chose Rive assets over Lottie assets due to their smaller size.

SwiftUICharts

We use SwiftUICharts to properly display the data gathered from the Device Activity Report. The charts are animated, offer various color schemes, and adapt to light and dark mode. Users can interact with the charts to explore the data.

Demo

Launch Screen

Animated GIF

Onboarding Screen (Light Mode)

Animated GIF

Home Screen

Animated GIF

Screen Time View

Animated GIF Animated GIF

Restrictions Screen

Animated GIF Animated GIF Animated GIF

Custom Sheild

Animated GIF

More Insights Screen

Animated GIF

Widget

Animated GIF Animated GIF Animated GIF

Notifications

Animated GIF

Acknowledgment

Special thanks to: DesignCode Youtube for the 3-hour tutorial with Rive Animations, custom fonts, as well as a provided codebase - https://www.youtube.com/watch?v=h4vyOz4Tztg&t=2878s

Roadmap

For future iterations of this project, we want to implement a couple of things:

  • Refactor to conform solely to MVVM architecture
  • Implement Unit tests for various modules

About

This project explores the capabilites of the iOS 16 Screen Time API which is composed of three frameworks: Managed Settings, Family Controls, Device Activity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages