BlockBeat is a privacy-focused iOS application that visualizes pedestrian activity patterns in urban areas using hexagonal H3 grid overlays. This prototype demonstrates the complete data pipeline from fake data generation through H3 processing to map visualization, with full privacy compliance features.
- Real-time Map Visualization: Interactive map centered on Chicago's Magnificent Mile
- H3 Hexagonal Grid: Pedestrian density visualization using Uber's H3 geospatial indexing
- Privacy-First Design: Anonymous data aggregation with comprehensive privacy controls
- Fake Data Generation: Sophisticated pedestrian simulation for prototype testing
- Activity Detection: Multiple activity types (walking, running, cycling, stationary)
- Density Heatmap: Color-coded hexagons showing pedestrian concentration levels
- Permission Management: Granular control over location and Bluetooth permissions
- Anonymous Aggregation: No personal identifiers stored or transmitted
- Privacy Policy: Comprehensive privacy documentation
- Data Source Toggle: Switch between fake and real data collection
- Compliance Ready: Prepared for GDPR, CCPA, and App Store requirements
โโโโโโโโโโโโโโโโโโโ
โ ContentView โ โ SwiftUI Views
โโโโโโโโโโโโโโโโโโโค
โ MapViewModel โ โ ViewModels (ObservableObject)
โโโโโโโโโโโโโโโโโโโค
โ Services โ โ Business Logic
โโโโโโโโโโโโโโโโโโโค
โ Models โ โ Data Structures
โโโโโโโโโโโโโโโโโโโ
LocationData
: Core data structure for pedestrian locationsH3DataPoint
: H3 hexagon with aggregated pedestrian count
FakeDataService
: Generates realistic pedestrian movement patternsH3ProcessingService
: Aggregates location data into H3 hexagonsMapOverlayService
: Creates map overlays from H3 dataPermissionManager
: Handles privacy permissions and complianceLocationService
: Manages device location (prepared for real data)BluetoothService
: Bluetooth scanning for density measurement
MapViewModel
: Orchestrates data flow and map state management
ContentView
: Main application interfaceMapView
: MKMapView wrapper with H3 overlay support
- iOS 14.0+ (Minimum deployment target)
- Xcode 14.0+ (Recommended)
- Swift 5.5+
- No external dependencies (H3 library included)
-
Clone the repository
git clone [repository-url] cd BlockBeat
-
Open in Xcode
open BlockBeat.xcodeproj
Or open Xcode and select File โ Open โ Navigate to BlockBeat.xcodeproj
-
Configure Signing
- Select the BlockBeat project in navigator
- Go to Signing & Capabilities tab
- Select your development team
- Update bundle identifier if needed
-
Build and Run
- Select target device or simulator (iPhone recommended)
- Press โ+R or click the Run button
- App will launch with map centered on Chicago
- Map Display: The app opens with a map view of Chicago's Magnificent Mile
- Automatic Data Generation: Fake pedestrian data is automatically generated
- Hexagonal Overlays: H3 hexagons appear showing density patterns
- Legend: View the density legend using the eye icon
- Pan: Drag to move around the map
- Zoom: Pinch to zoom in/out
- Rotate: Two-finger rotate gesture
- Center: Double-tap to center on location
- Tap the antenna icon (top-left)
- Select "Real Data" to enable permission requests
- Default mode uses sophisticated fake data generation
- Tap the eye icon (top-right)
- Shows/hides the density color legend
- Green: Low density (1-2 people)
- Yellow: Medium density (3-5 people)
- Red: High density (>5 people)
- Tap the antenna icon
- View current permission status
- Request individual permissions as needed
- Toggle real-time data collection on/off
The prototype includes comprehensive integration tests:
// In IntegrationTest.swift
let tester = IntegrationTest()
await tester.runAllTests()
Test Coverage:
- โ Fake Data Generation
- โ H3 Processing Pipeline
- โ Map Overlay Generation
- โ Privacy Compliance
- โ Performance Under Load
- โ Data Flow Integration
- โ UI Component Integration
- โ Error Handling
- โ Reactive Updates
- โ End-to-End Scenario
- App launches successfully
- Map displays centered on Chicago
- Fake data generates and displays
- Hexagonal overlays render correctly
- Colors match density levels
- Legend shows/hides properly
- Permission dialogs work
- Data source toggle functions
- Map gestures work smoothly
- No memory leaks or crashes
- Startup Time: < 2 seconds
- Data Generation: 100 pedestrians in < 0.5s
- H3 Processing: 1000 points in < 1s
- Map Rendering: 60 FPS with 100+ hexagons
- Memory Usage: < 50MB typical
- Battery Impact: Minimal in fake data mode
- Differential overlay updates
- Lazy H3 calculation
- Efficient memory management
- Throttled reactive updates
- Optimized map rendering
Fake Data Generation
โ
LocationData
โ
H3 Processing Service
โ
H3DataPoint
โ
Map Overlay Service
โ
MKPolygon
โ
Map View
- Realistic Distribution: Clusters around POIs
- Activity Variety: Walking, running, cycling patterns
- Temporal Variation: Time-based density changes
- Boundary Constraints: Stays within specified radius
- Reproducible: Seed-based generation for testing
- Anonymous: No personal identifiers
- Aggregated: Individual paths not tracked
- Local Processing: H3 aggregation on-device
- No Cloud Storage: Prototype runs entirely locally
- Location: When-in-use and always options
- Bluetooth: For enhanced density detection
- Notifications: For activity alerts (future)
- Info.plist: All required usage descriptions
- Privacy Manifest: Declares data collection types
- User Control: Granular permission management
- Transparency: Clear privacy policy
- Fake Data Only: Real data collection code present but disabled
- No Backend: All processing is local
- No Persistence: Data resets on app restart
- Limited Area: Focused on Chicago for demo
- No User Accounts: Anonymous usage only
- Real pedestrian data collection
- Backend API integration
- Historical data visualization
- Multiple city support
- Social features (anonymized)
- Advanced analytics
- Core Data persistence
- CloudKit sync
- Widget support
- Apple Watch companion
- AR visualization mode
BlockBeat/
โโโ App/
โ โโโ BlockBeatApp.swift # App entry point
โโโ Models/
โ โโโ LocationData.swift # Location data model
โ โโโ H3DataPoint.swift # H3 hexagon model
โโโ Views/
โ โโโ ContentView.swift # Main UI
โ โโโ MapViewExtensions.swift # Map helpers
โโโ ViewModels/
โ โโโ MapViewModel.swift # Map state management
โโโ Services/
โ โโโ FakeDataService.swift # Data generation
โ โโโ H3ProcessingService.swift # H3 aggregation
โ โโโ MapOverlayService.swift # Overlay creation
โ โโโ PermissionManager.swift # Privacy management
โ โโโ LocationService.swift # Location tracking
โ โโโ BluetoothService.swift # BLE scanning
โโโ Utilities/
โ โโโ Constants.swift # App constants
โโโ Info.plist # App configuration
This is a prototype project. For production development:
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Submit a pull request
- Ensure all tests pass
Copyright ยฉ 2025 BlockBeat. All rights reserved.
This is a prototype application for demonstration purposes.
Map doesn't show data
- Ensure location permissions are granted (Settings โ Privacy โ Location Services)
- Try regenerating fake data (restart app)
Performance issues
- Reduce pedestrian count in MapViewModel
- Check device has sufficient memory
- Disable debug overlays
Build errors
- Clean build folder (โ+Shift+K)
- Update to latest Xcode
- Check minimum iOS version (14.0)
Permission dialogs not appearing
- Check Info.plist has all usage descriptions
- Reset simulator permissions
- Verify permission manager initialization
For questions about this prototype:
- Review the architecture specification
- Check integration test results
- Examine code comments and documentation
Before deploying to TestFlight:
- Update version number
- Set release build configuration
- Disable debug logging
- Test on physical device
- Verify all permissions work
- Run full integration test suite
- Update screenshots
- Archive and validate
- Uber H3: Hexagonal hierarchical geospatial indexing system
- Apple MapKit: Native iOS mapping framework
- SwiftUI: Modern declarative UI framework
- Combine: Reactive programming framework
Version: 1.0.0 (Prototype)
Last Updated: January 2025
Status: โ
Ready for Testing