Skip to content

About

This is a feature-project app which will let the user set a timer to restrict apps usage and focus. The app uses DeviceActivityMonitor and Screen Time API.

Resources

Stars

10 stars

Watchers

1 watching

Forks

Repository files navigation

StayFocused

iOS – App Icon

StayFocused is an iOS feature-project that lets users define timers to restrict app usage and help them stay focused by leveraging Apple’s Screen Time and Device Activity frameworks. It uses the DeviceActivityMonitor API to schedule start/end events for focus sessions and the Screen Time API to enforce usage limits. The codebase is organized into Swift targets including the main app, a Device Activity extension, and a Widget for quick glance controls.

Features

  • Custom Timer Schedules: Define focus windows with start/end times and app-specific thresholds.

  • Device Activity Monitoring: Automatically trigger extensions at the beginning and end of each timer session using DeviceActivityMonitor.

  • Screen Time Enforcement: Apply ManagedSettings rules to block or limit app usage once the timer expires.

  • Home Screen Widget: Control and view focus sessions directly from the live activity or the dynamic island powered by the TimerActivityWidget target.

Screenshots

Live Activity

LiveActivity

Timer

Timer

Shield

Shield

Screen Time Authentication

ScreenTimeAPI

Project Structure

  • StayFocused/ – SwiftUI app entry point and views.

  • TimerMonitor/ – Implements DeviceActivityMonitor schedules and thresholds.

  • TimerActivityContent/ – Defines the DeviceActivityReport extension UI.

  • TimerActivityWidget/ – SwiftUI Widget for quick session info.

  • TimerActivityUI/ – Shared UI components for the timer extension.

Installation

  1. Clone the repository:

    git clone https://github.com/killlilwinters/StayFocused-ScreenTimeAPI.git
    
  2. Open StayFocused.xcodeproj in Xcode.

  3. In your target's Signing & Capabilities, add the FamilyControls entitlement to your .entitlements file and enable the DeviceActivity capability if needed.

  4. Build and run on either a physical device or the Simulator (fully supported on Simulator).

About

This is a feature-project app which will let the user set a timer to restrict apps usage and focus. The app uses DeviceActivityMonitor and Screen Time API.

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages