An iOS app that helps you stay focused by sending exercise reminders when you open social media apps.
- Walking Timer: Track your exercise minutes with a simple start/stop timer
- Daily Stats: View your total exercise minutes for the day
- Smart Notifications: Receive reminders to exercise when you open Instagram, TikTok, or YouTube
- Background Operation: Notifications work without opening the app
- Privacy First: No Screen Time API required, works with free Apple Developer account
- iOS 16.0+
- Xcode 15.0+
- Free or paid Apple Developer account
Lock In/
├── LockInApp.swift # Main app entry point with TabView
├── Managers/
│ └── AppBlockerManager.swift # State management and persistence
├── AppIntents/
│ └── ExerciseReminderIntent.swift # App Intent for Shortcuts integration
├── Views/
│ ├── WalkingTab.swift # Walking timer interface
│ ├── StatsTab.swift # Statistics display
│ └── SetupInstructionsView.swift # Setup guide for users
├── Assets.xcassets/ # App assets and accent color
└── Info.plist # App configuration
-
Open the Project
open "Lock In.xcodeproj" -
Configure Signing
- Select the "Lock In" target in Xcode
- Go to "Signing & Capabilities"
- Select your team from the dropdown
- The bundle identifier will automatically update
-
Build and Run
- Select your target device or simulator
- Press Cmd+R or click the Run button
- Grant notification permissions when prompted
The app uses iOS Shortcuts automations to detect when you open social media apps and send exercise reminders.
-
Open Shortcuts App
- Launch the Shortcuts app on your iPhone
-
Create a New Automation
- Tap "Automation" at the bottom
- Tap the "+" button
- Select "App" as the trigger
-
Configure for Instagram
- Choose Instagram from the app list
- Set to "Is Opened"
- Tap "Next"
-
Add the Reminder Action
- Search for "Send Exercise Reminder"
- Add it as the action
- Set the app name to "Instagram"
-
Configure Automation Settings
- Turn OFF "Ask Before Running"
- Turn ON "Notify When Run" (optional)
- Tap "Done"
-
Repeat for Other Apps
- Create similar automations for TikTok, YouTube, or any other apps
- Each automation should have its own app name parameter
For step-by-step instructions with explanations, tap the info button (ℹ️) in the Walk tab within the app.
The app uses the App Intents framework with the following configuration:
struct ExerciseReminderIntent: AppIntent {
static var openAppWhenRun: Bool = false // Runs in background
@Parameter(title: "App Name")
var appName: String
func perform() async throws -> some IntentResult {
// Sends notification without opening the app
let content = UNMutableNotificationContent()
content.title = "Time to Exercise!"
content.body = "\(appName) can wait. Get moving!"
// ... notification delivery
}
}Exercise sessions are tracked using AppBlockerManager:
- Walking Timer: Tracks start time and calculates elapsed minutes
- Daily Stats: Stores total minutes with automatic midnight reset
- Persistence: Uses UserDefaults to save state across app launches
The app requests notification permissions on launch:
UNUserNotificationCenter.current().requestAuthorization(
options: [.alert, .sound, .badge]
)Central state management class that:
- Tracks walking session state
- Calculates elapsed time
- Persists data to UserDefaults
- Handles day-to-day reset logic
App Intent that:
- Accepts an app name parameter
- Runs in background mode
- Sends UserNotification
- Appears in Shortcuts app automatically
- WalkingTab: Main interface with timer display and start/stop controls
- StatsTab: Shows total exercise minutes for the current day
- SetupInstructionsView: Comprehensive guide for setting up automations
Edit the PRODUCT_BUNDLE_IDENTIFIER in [Lock In.xcodeproj/project.pbxproj](Lock In.xcodeproj/project.pbxproj#L600) or change it in Xcode's target settings.
Edit the notification content in [Lock In/AppIntents/ExerciseReminderIntent.swift](Lock In/AppIntents/ExerciseReminderIntent.swift#L23):
content.title = "Your Custom Title!"
content.body = "Your custom message here"The app uses orange as the accent color. To change it:
- Open [Lock In/Assets.xcassets/AccentColor.colorset/Contents.json](Lock In/Assets.xcassets/AccentColor.colorset/Contents.json)
- Modify the RGB values
- Or use Xcode's color picker in Assets.xcassets
- Build and run the app at least once on your device
- Wait a few minutes for iOS to index the intent
- Force quit and reopen the Shortcuts app
- Search for "Send Exercise Reminder" or "Lock In"
- Check that notification permissions are granted:
- Settings → Lock In → Notifications → Allow Notifications
- Verify the automation is set to run without asking:
- Open the automation in Shortcuts
- Ensure "Ask Before Running" is OFF
- Test the intent manually in Shortcuts before setting up automation
The app resets stats at midnight based on the device's timezone. If stats aren't resetting:
- Check your device's date and time settings
- Ensure "Set Automatically" is enabled
- Try force-quitting and reopening the app
This app is designed to work with a free Apple Developer account:
- No App Groups required
- No Screen Time API
- No special entitlements needed
- Just sign with your Apple ID in Xcode
Lock In respects your privacy:
- No data collection or analytics
- No internet connection required
- All data stored locally on your device
- No third-party dependencies
This project is provided as-is for educational and personal use.
For issues or questions, please refer to the in-app setup instructions or check the code documentation.