A competitive screen time tracking iOS app that gamifies reducing phone usage through friend leagues, betting, and high-friction blocking.
Download on the App Store now! App Store Link
- SwiftUI with MVVM pattern
- iOS 17+ (Swift Charts, modern SwiftUI APIs)
- Apple Screen Time APIs: FamilyControls, DeviceActivity, ManagedSettings
Tuff/
├── Tuff/ # Main app target
│ ├── App/
│ │ ├── TuffApp.swift # App entry point + authorization
│ │ └── ContentView.swift # Root tab navigation
│ ├── Theme/
│ │ └── Theme.swift # Colors, fonts, reusable components
│ ├── Models/
│ │ ├── User.swift # User & LeagueMember models
│ │ ├── League.swift # League & history models
│ │ └── ScreenTimeData.swift # Screen time data models
│ ├── Services/
│ │ ├── ScreenTimeManager.swift # FamilyControls/DeviceActivity integration
│ │ └── NotificationManager.swift # Push notification handling
│ ├── ViewModels/
│ │ ├── HomeViewModel.swift
│ │ ├── StatsViewModel.swift
│ │ └── ProfileViewModel.swift
│ ├── Views/
│ │ ├── Home/ # Home screen (carousel, leagues)
│ │ ├── League/ # League detail, leaderboard, create
│ │ ├── Profile/ # Profile & league history
│ │ ├── Stats/ # Charts & streak tracking
│ │ └── Components/ # Reusable UI components
│ └── Assets.xcassets/
├── TuffDeviceActivity/ # DeviceActivity Monitor extension
├── TuffShieldConfiguration/ # Shield UI customization extension
└── project.yml # XcodeGen project specification
-
Install XcodeGen:
brew install xcodegen
-
Generate the Xcode project:
cd Tuff xcodegen generate -
Open
Tuff.xcodeprojin Xcode -
Set your Development Team in project settings
-
Build and run on a physical device (Screen Time APIs require a real device)
GoogleService-Info.plistis in the repo root and is added to the Tuff target (copy bundle resources).- Firebase is initialized in
TuffAppviaAppDelegateandFirebaseApp.configure(). - Linking (per Firebase iOS setup): Add the SDK via File → Add Package Dependencies →
https://github.com/firebase/firebase-ios-sdk. When choosing libraries, add FirebaseCore (and FirebaseAuth, FirebaseFirestore if needed) and set Add to Target to Tuff. The Tuff target has Other Linker Flags-ObjCset (required by Firebase). - If you still see "No such module 'FirebaseCore'":
- In Xcode: File → Packages → Reset Package Caches.
- Product → Clean Build Folder (⇧⌘K).
- Quit Xcode, delete DerivedData for this project:
rm -rf ~/Library/Developer/Xcode/DerivedData/Tuff-* - Reopen the project and build again (⌘B).
- Open Xcode → File → New → Project → iOS App
- Product Name: Tuff, Interface: SwiftUI, Language: Swift
- Replace the generated files with the files from
Tuff/ - Add entitlements:
- Select the Tuff target → Signing & Capabilities
- Add "Family Controls" capability
- Add extension targets:
- File → New → Target → Device Activity Monitor Extension (name: TuffDeviceActivity)
- File → New → Target → Shield Configuration Extension (name: TuffShieldConfiguration)
- Replace generated files with those from
TuffDeviceActivity/andTuffShieldConfiguration/
- Build and run
| Framework | Purpose |
|---|---|
| FamilyControls | Request authorization to access screen time data |
| DeviceActivity | Monitor daily usage, set thresholds, track intervals |
| ManagedSettings | Block/shield apps, enforce restrictions |
| ManagedSettingsUI | Customize the shield shown on blocked apps |
App Blocking (Friend 2FA):
- User selects apps to block via
FamilyActivityPicker ManagedSettingsStoreapplies shields to those apps- When blocked app is opened,
ShieldConfigurationExtensionshows custom UI - Friend sends 2FA code → shields are removed
Activity Monitoring:
DeviceActivityCenterstarts daily monitoring scheduleDeviceActivityMonitorextension tracks usage in the background- Thresholds trigger notifications and shield activation
- Leagues: Create competitive groups, set buy-ins, track rankings
- Friend 2FA Blocking: Apps stay locked until a friend sends you a code
- Custom Challenges: Complete productive tasks to earn screen time
- Live Leaderboards: Real-time rankings within each league
- Stats & Charts: 7-day / 30-day screen time visualization with Swift Charts
- Streak Tracking: Consecutive days under your screen time goal
- Push Notifications: League alerts, daily recaps, streak reminders
- Payout System: Winner-takes-all or tiered payouts
- iOS 17.0+
- Xcode 15.0+
- Physical device (Screen Time APIs don't work in Simulator)
- Apple Developer account with Family Controls entitlement
The Screen Time APIs require special entitlement approval from Apple:
- Go to developer.apple.com
- Navigate to Account → Certificates, Identifiers & Profiles → Identifiers
- Select your App ID → Enable "Family Controls"
- Submit the request form explaining your use case
- Apple typically approves within 1–2 weeks