Skip to content
markksantosPublic

Repository files navigation

💧 Drip

Track hotspot data usage in real time — know before you hit your limit

Swift SwiftUI macOS License

Features · Getting Started · Tech Stack


✨ Features

  • Real-Time Monitoring — Tracks bytes sent and received through your hotspot connection with 2-second polling
  • Hotspot Detection — Automatically detects iPhone/iPad hotspots via WiFi, USB, or Bluetooth tethering
  • Data Limit Alerts — Configurable alerts at 50%, 75%, 90%, and 100% of your data cap
  • Billing Cycle Resets — Automatic usage resets on daily, weekly, monthly, or manual schedules
  • Multi-Profile Support — Different data limits and settings for each hotspot
  • Session History — View past sessions with download/upload breakdown
  • Menu Bar Icon — Water droplet fill indicator shows usage at a glance
  • Launch at Login — Start automatically with macOS
  • Menu Bar Only — No dock icon, minimal footprint

🚀 Getting Started

Prerequisites

  • macOS 13.0+ (Ventura)
  • Swift 5.9+
  • Location permission on macOS 14+ (for WiFi SSID identification)

Installation

git clone https://github.com/markksantos/Drip.git
cd Drip
./bundle.sh
cp -r .build/debug/Drip.app /Applications/
## Build & run

# Build with Swift Package Manager
swift build

# Run the 94-test suite
swift test

# Or use the setup script (build + test + open in Xcode)
./init.sh

Or build and run directly:

open .build/debug/DripApp

Run it as a menu bar app

swift run DripApp does not give the executable an app bundle, so the menu bar item and notifications won't behave correctly. Build a real .app bundle instead:

Release build → signed, runnable .app at .build/release/Drip.app

open .build/release/Drip.app

bundle.sh ad-hoc-signs the bundle so it runs on the build machine with no Apple account. Shipping to other Macs needs a Developer ID and notarization — see DISTRIBUTION.md.

Diagnostics

If hotspot detection misbehaves, ./diagnose.swift prints the live CoreWLAN state, every network interface's byte counters, and whether any interface holds an iPhone-hotspot IP (172.20.10.x). Useful for confirming which interface Drip should be tracking.

Permissions

Permissions

Drip requires Network access to read interface byte counters and WiFi Info access to identify hotspot names. On macOS 14+, reading the WiFi SSID also requires Location Services — your actual location is never accessed or stored.

🛠️ Tech Stack

Category Technology
Language Swift 5.9+
UI SwiftUI
Networking CoreWLAN, Network framework
Data Tracking Darwin/ifaddrs
Notifications UserNotifications
Persistence UserDefaults
Platform macOS 13+ (Ventura)

📁 Project Structure

Drip/ ├── Sources/ │ ├── Drip/ │ │ ├── Models.swift # HotspotProfile, UsageSession, ConnectionState │ │ └── Constants.swift # App-wide defaults and identifiers │ ├── DripEngine/ │ │ ├── DripEngine.swift # Facade orchestrating all components │ │ ├── HotspotDetector.swift # WiFi/USB/Bluetooth hotspot detection │ │ ├── DataTracker.swift # Interface byte counting via getifaddrs() │ │ ├── ProfileManager.swift # Multi-profile and reset cycle management │ │ ├── UsageStore.swift # UserDefaults persistence │ │ └── AlertManager.swift # Threshold notification scheduling │ ├── DripUI/ │ │ ├── ViewModels.swift # DripViewModel, ByteFormatter, DisplayFormat │ │ ├── MenuBarIcon.swift # Water droplet icon with fill level │ │ ├── PopoverView.swift # Connected state popover │ │ ├── SettingsView.swift # General, Profiles, History, About tabs │ │ └── NotConnectedView.swift # Disconnected state display │ └── DripApp/ │ └── main.swift # App entry point with MenuBarExtra ├── Tests/ │ ├── DripEngineTests/ │ │ └── DripEngineTests.swift # 40 engine tests │ ├── DripUITests/ │ │ └── DripUITests.swift # 33 UI/ViewModel tests │ └── IntegrationTests/ │ ├── ModelsTests.swift # Model tests │ └── ConstantsTests.swift # Constants validation tests ├── bundle.sh # Build release .app bundle ├── init.sh # Build, test, and open └── Package.swift The project is organized as a Swift Package with four targets:

  • Drip — shared data models (HotspotProfile, UsageSession, ConnectionState, ResetCycle) and constants
  • DripEngine — hotspot detection, byte-counting data tracker, alert manager, profile manager, and UserDefaults persistence. Every system boundary (CoreWLAN, getifaddrs, UNUserNotificationCenter) sits behind a protocol for testability.
  • DripUI — SwiftUI views: the menu bar droplet that fills from the bottom as data is used, the connected/disconnected popovers, and the settings window
  • DripApp — the MenuBarExtra entry point wiring the engine to the UI

A marketing landing page (Next.js static export) lives in landing/:

cd landing && npm install && npm run build # static site in landing/out/

Tests live in Tests/ — engine unit tests, UI/view-model tests, model tests, and an end-to-end suite (Tests/IntegrationTests/EndToEndTests.swift) that drives connect → track → alert → disconnect through the DripEngine facade with mock protocols.

📄 License

MIT License © 2025 Mark Santos MIT © 2026 Mark Santos

Releases

Packages

Contributors

Languages