Your AI companion for the walk home.
SafeWalk is an iOS app that keeps an eye on you when you're walking alone — late at night, leaving a party, or crossing campus. An AI chatbot checks in with you at regular intervals; if you stop responding or stop moving, it raises an alert and gives you one tap to call campus police, so help is never more than a button away.
- AI check-in companion — A friendly chatbot powered by Google Gemini messages you on a timer ("Just checking in! Reply if you're okay") and holds a natural, supportive conversation while you walk.
- Live location map — A MapKit view tracks your position in real time using Core Location.
- Inactivity & no-movement detection — If you don't reply or you stop moving for too long, the app assumes something may be wrong and escalates automatically.
- One-tap emergency escalation — A push notification with a "Call UT Police" action dials campus police (512-471-4441) directly from the lock screen.
- Emergency contacts — Add and manage trusted contacts, persisted locally with
UserDefaults.
| Mechanism | Detail |
|---|---|
| Check-in timer | Prompts you every 60 seconds; resets whenever you respond. |
| Inactivity threshold | No reply or no movement for 2 minutes triggers an alert. |
| Movement detection | CLLocationManager flags movement when you travel more than 5 m. |
| Escalation | Local notification with an actionable "Call UT Police" button (tel://). |
| Area | Technology |
|---|---|
| UI | SwiftUI (iOS 18+) |
| Language | Swift 5 / Xcode |
| AI chat | Google Gemini (gemini-2.0-flash) |
| Location & maps | Core Location + MapKit |
| Notifications | UserNotifications (actionable categories) |
| Persistence | UserDefaults (Codable emergency contacts) |
Screenshots coming soon — run the app in the iOS Simulator and capture the chat, live map, and emergency-contacts screens.
SafetyWatcherView— the main screen: live map, check-in countdown, chat feed, and emergency-contacts panel.GeminiManager— a singleton that wraps the Gemini REST API withCodablerequest/response models.LocationManager— anObservableObjectCLLocationManagerDelegatethat publishes location updates and fires a movement callback.NotificationDelegate— handles the actionable notification and places the emergency call.
- Clone the repo and open
Party Watcher.xcodeprojin Xcode. - Get a Google Gemini API key from Google AI Studio.
- Copy the secrets template and add your key:
Then edit
cp "Party Watcher/Secrets.example.swift" "Party Watcher/Secrets.swift"
Secrets.swiftand setgeminiAPIKey. This file is gitignored and never committed. - Build and run on a device or simulator (location features work best on a real device).
This project was built as a campus-safety prototype for the University of Texas at Austin; the emergency-call action is wired to UTPD. The escalation logic is a proof of concept and is not a substitute for emergency services — always call 911 in a real emergency.
MIT © William Mar