A field hockey goalkeeper performance tracking app for iOS, built with SwiftUI and powered by Apple's Vision framework for automatic ball detection.
- Automatic Ball Tracking — Uses Vision framework contour detection and object tracking to follow the ball in real time, no manual input needed.
- Auto Goal Detection — Automatically identifies the goal using rectangle detection and determines whether each shot was a goal or a save.
- Landscape Camera View — Forces landscape orientation during recording for maximum field of view.
- Video Clip Export — Continuously records during a match and exports trimmed clips (±3 seconds around each event) to the Photos library.
- Match Management — Create matches, track goals conceded and saves, and review match history.
- Statistics Dashboard — View save percentage, total saves, and performance trends across matches.
- Shot Map — Visual representation of shot events during a match.
- iOS 17.0+
- Xcode 15.0+
- iPhone with rear camera (camera features unavailable in Simulator)
- Clone the repository:
git clone https://github.com/brendonhumphreys/KeepR.git
- Open
KeepR.xcodeprojin Xcode. - Select a development team under Signing & Capabilities.
- Build and run on a physical device.
- Create a match — Enter the opponent name and venue.
- Start camera tracking — The app opens in landscape with the rear camera.
- Automatic detection — The Vision framework scans for the ball and goal:
- Ball tracking uses
VNTrackObjectRequestwith contour-based re-detection when tracking is lost. - Goal detection uses
VNDetectRectanglesRequestto find the goal frame, running every ~1 second.
- Ball tracking uses
- Event recording — When the ball enters and stays in the goal zone for multiple frames, a goal is logged. If it approaches but leaves, a save is logged.
- Clip export — On ending the session, video clips are trimmed around each detected event and saved to Photos.
KeepR/
├── KeepRApp.swift # App entry point + AppDelegate for orientation lock
├── ContentView.swift # Tab bar + shared components
├── Models/
│ ├── Match.swift # SwiftData match model
│ └── ShotEvent.swift # SwiftData shot event model
├── Camera/
│ ├── CameraManager.swift # AVCaptureSession, recording, goal evaluation
│ ├── BallTrackerService.swift # Vision ball tracking + goal rectangle detection
│ └── CameraPreviewView.swift # UIViewRepresentable camera preview
└── Views/
├── HomeView.swift # Home tab + new match form
├── LiveMatchView.swift # Live match timer and camera launcher
├── CameraTrackingView.swift # Full-screen landscape camera overlay
├── MatchHistoryView.swift # Match list with swipe-to-delete
├── MatchDetailView.swift # Match detail with timeline
├── ShotMapView.swift # Visual shot map
└── StatsView.swift # Statistics dashboard
Copyright (c) 2026 Brendon Humphreys. All rights reserved.
This project is licensed under the MIT License — see the LICENSE file for details.