A privacy-first, open-source cigarette tracking app for iOS and watchOS designed to help users monitor their smoking habits and work towards reducing consumption. Built with SwiftUI, SwiftData, and CloudKit for seamless synchronization across all devices.
- One-tap logging: Quick cigarette tracking with timestamp and contextual tagging
- Unified Tag System: Smart categorization with predefined and custom tags (stress, work, coffee, social, etc.)
- iCloud sync: Real-time data synchronization across iPhone and Apple Watch
- Privacy-first: All data stays on your devices and personal iCloud account
- Production-ready: Complete app ready for App Store deployment
- Smart Pattern Recognition: AI-powered analysis of smoking patterns and triggers
- Just-In-Time Interventions (JITAI): Contextual coaching when you need it most
- HealthKit Integration: Heart rate and activity data for comprehensive insights
- Behavioral Analysis: Advanced machine learning for personalized recommendations
- Multiple Coaching Moods: Supportive, motivational, analytical approaches
- Siri support: "Hey Siri, I smoked a cigarette" in all supported languages
- Widget support: Small and medium home screen widgets with real-time sync
- App Shortcuts: Custom shortcuts integration with iOS 17+ App Intents
- Watch app: Native Apple Watch experience with full sync capabilities
- Fastlane integration: Automated deployment and App Store metadata management
- Advanced Statistics: Daily, weekly, monthly trends with visual charts
- Pattern recognition: Machine learning insights into smoking triggers
- Tag analytics: Comprehensive analysis of contextual smoking patterns
- Progress tracking: Visual progress indicators and milestone celebrations
- Wellness Journey: Structured quit programs with coaching support
- 5 Languages: English, Italian, Spanish, French, and German
- Complete localization: All UI, widgets, permissions, and App Store metadata
- App Store ready: Fully localized metadata for international distribution
- Accessibility: VoiceOver support in all languages
[Screenshots would go here in a real project]
- Xcode 15.0 or later
- iOS 17.0+ / watchOS 10.0+
- Apple Developer account (for device testing and App Store distribution)
-
Clone the repository
git clone https://github.com/yourusername/mirror-smoker.git cd mirror-smoker -
Open in Xcode
open MirrorSmokerStopper.xcodeproj
-
Configure Bundle Identifiers
- Main app:
com.yourteam.mirrorsmoker - Widget extension:
com.yourteam.mirrorsmoker.widget - Watch app:
com.yourteam.mirrorsmoker.watchapp
- Main app:
-
Enable Capabilities
- iCloud (CloudKit) for data synchronization
- App Groups for widget/app data sharing
- Sign in with Apple (optional)
-
Build and Run
- Select your target device
- Build and run the project (β+R)
- Grant necessary permissions (notifications, Siri)
- Optionally create a user profile
- Start logging your cigarettes
- Add widgets to your Home screen for quick access
The app includes home screen widgets that allow quick cigarette logging:
- Small Widget: Shows today's cigarette count with color-coded status and quick add button
- Medium Widget: Displays today's count, last cigarette time, daily average, and add button
Sync architecture for Widgets, App, and Watch is unified:
- Widgets and the app both read/write from the same SwiftData store located in the App Group (
group.fightthestroke.mirrorsmoker). - For fast loading, the app publishes a shared snapshot to App Group UserDefaults:
todayCountand a day-scoped JSON (cigarettes_yyyy-MM-dd). Widgets use this when appropriate. - Adding from the widget uses App Intents and writes directly into the App Group SwiftData store; the app updates the shared snapshot and reloads widget timelines.
- The watch app syncs via WatchConnectivity and the same App Group snapshot to keep the count aligned everywhere.
- Real-time Sync: Changes in the app appear in widgets instantly and vice versa
- Localized: Widget text adapts to your device language automatically
To add widgets:
- Long press on your home screen
- Tap the "+" button
- Search for ""widget.display.name" = "Fight The Smoke";"
- Choose your preferred size and add to home screen
- SwiftUI: Modern declarative UI framework
- SwiftData: Core Data successor for data persistence
- CloudKit: Apple's cloud database for sync
- App Intents: Siri and Shortcuts integration
- WidgetKit: Home screen widgets
Cigarette: Core smoking event with timestamp and unified tag systemTag: Unified categorization system with predefined and custom tagsUserProfile: User preferences, AI coach settings, and wellness journey progressProduct: Cigarette brands and types trackingSmokingInsight: AI-generated insights and pattern analysisUrgeLog: Craving tracking and resistance loggingStandardTriggerTag: Predefined context tags (stress, coffee, work, social)WellnessJourneyModels: Structured quit programs and milestones
MirrorSmokerStopper/
βββ Models/ # SwiftData models
β βββ Cigarette.swift # Core smoking events
β βββ Tag.swift # Unified tag system
β βββ UserProfile.swift # User data and preferences
β βββ SmokingInsight.swift # AI insights and analysis
β βββ UrgeLog.swift # Craving tracking
β βββ StandardTriggerTag.swift # Predefined context tags
β βββ WellnessJourneyModels.swift # Quit programs
βββ Views/ # SwiftUI views
β βββ Components/ # Reusable UI components with design system
β βββ Statistics/ # Advanced analytics and interactive charts
β βββ Settings/ # Configuration and preferences
β βββ Onboarding/ # User onboarding and setup
β βββ Profile/ # User profile and preferences
β βββ Progress/ # Progress tracking and milestones
β βββ Journey/ # Wellness journey and coaching
β βββ Today/ # Today's view and quick actions
βββ Utilities/ # Helper classes and extensions
β βββ DesignSystem/ # Comprehensive design system (DS)
β βββ AppGroupManager/ # Widget/app data synchronization
β βββ DateQueryHelpers/ # Date-based query utilities
β βββ AICoach/ # AI coaching and pattern analysis
βββ Resources/ # Complete localization (5 languages)
β βββ en.lproj/ # English (base)
β βββ it.lproj/ # Italian
β βββ es.lproj/ # Spanish
β βββ fr.lproj/ # French
β βββ de.lproj/ # German
β βββ Fonts/ # JetBrains Mono NL font family
βββ Extensions/ # Swift extensions and utilities
HomeWidget/ # Widget extension with full functionality
βββ HomeWidget.swift # Main widget with real-time sync
βββ AddCigaretteIntent.swift # Siri/Shortcuts integration
βββ HomeWidgetBundle.swift # Widget bundle configuration
MirrorSmokerStopper Watch App/ # Native watchOS app
βββ ContentView.swift # Watch interface
βββ ConnectivityManager.swift # Phone-watch sync
βββ WatchOS Extensions/ # Watch-specific features
fastlane/ # Automated deployment and App Store management
βββ Fastfile # Deployment automation
βββ Appfile # App configuration
βββ Matchfile # Certificate management
βββ metadata/ # 5-language App Store metadata
βββ en-US/ # English App Store listing
βββ it/ # Italian App Store listing
βββ es-ES/ # Spanish App Store listing
βββ fr-FR/ # French App Store listing
βββ de-DE/ # German App Store listing
The app uses a custom design system (DS) that provides:
- Typography: JetBrains Mono NL font family with system font fallbacks
- Colors: Comprehensive color palette with semantic naming
- Spacing: 8pt grid system for consistent layouts
- Components: Reusable UI components (cards, buttons, forms)
- Accessibility: VoiceOver support with descriptive labels
- Responsive: Adaptive sizing for different screen sizes
- Dark/Light mode: Full theme support
- Cigarette count and timing
- User-defined tags and categories
- Usage patterns (for insights)
- Personal identifying information
- Location data
- Third-party analytics
- Advertising data
All data is stored locally and synchronized through your personal iCloud account.
This app is production-ready and includes:
- Complete 5-language localization
- Fastlane automated deployment
- App Store metadata in all supported languages
- Production-grade error handling and logging
- HealthKit and notification permissions properly configured
# Run unit tests
β+U in Xcode
# Run UI tests
Select UI test target and run
# Test files available:
# - SyncTests.md: Synchronization testing documentation
# - TestReport.md: Comprehensive test reportsThe project includes a fully automated App Store pipeline:
Release lane (fastlane release) performs:
- Git clean + branch check (master)
- Match (certificates for app, watch, widget)
- Version bump (NEW_VERSION or BUMP_TYPE=patch|minor|major, default patch)
- Build number bump (timestamp if USE_TIMESTAMP_BUILD=1)
- Optional tests (skip with FASTLANE_SKIP_TESTS=1)
- Screenshot pipeline (skip with SKIP_SCREENSHOTS=1)
- Precheck (if APP_STORE_CONNECT_API_KEY_PATH set)
- Build IPA (app-store export)
- Deliver: metadata + screenshots + binary + submit_for_review (manual release)
- Commit, tag (v), push
Beta lane (fastlane beta) performs:
- Git clean check
- Build number only bump (timestamp optional)
- Build + upload to TestFlight
- Commit version bump
Environment variables:
- NEW_VERSION=1.2.0 (explicit marketing version)
- BUMP_TYPE=minor (overrides default patch when NEW_VERSION absent)
- USE_TIMESTAMP_BUILD=1 (use YYYYMMDDHHMM as build)
- FASTLANE_SKIP_TESTS=1 (skip scan tests)
- SKIP_SCREENSHOTS=1 (skip screenshots generation in release)
- DRY_RUN=1 (skip deliver/upload + git push/tag)
- APP_STORE_CONNECT_API_KEY_PATH=fastlane/AuthKey_XXXX.p8 (enables precheck)
Example dry run:
BUNDLER_VERSION=2.7.1 bundle _2.7.1_ exec fastlane release DRY_RUN=1 FASTLANE_SKIP_TESTS=1 SKIP_SCREENSHOTS=1Normal release:
bundle exec fastlane releaseTestFlight beta:
bundle exec fastlane beta# Install fastlane dependencies
bundle install
# Run tests and build
bundle exec fastlane test
# Deploy to TestFlight
bundle exec fastlane beta
# Deploy to App Store
bundle exec fastlane release- Follow the existing SwiftUI + SwiftData architecture
- Add comprehensive unit and UI tests
- Update all 5 localization files (en, it, es, fr, de)
- Consider watch app compatibility and sync requirements
- Update fastlane metadata if user-facing
- Test AI Coach integration if applicable
- Follow Swift API Design Guidelines
- Use SwiftUI best practices with design system (DS)
- Implement comprehensive error handling
- Maintain privacy-first architecture
- Document AI Coach integrations
- Keep accessibility in mind (VoiceOver support)
We welcome contributions! Please see our Contributing Guide and Code of Conduct.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- New language translations
- UI/UX improvements
- Additional analytics features
- Bug fixes and performance improvements
- Documentation updates
- Production Readiness: Fully deployed with critical fixes and optimizations
- Complete Localization: 5 languages (EN, IT, ES, FR, DE) with App Store metadata
- AI Coach System: Complete implementation with multiple coaching personalities
- Advanced Analytics: Comprehensive statistics with pattern recognition
- Premium Features: In-app purchases with StoreKit integration
- Health Integration: HealthKit permissions and heart rate monitoring
- Cross-Platform Sync: iPhone, Apple Watch, and widget synchronization
- Automated Deployment: Fastlane integration with multi-language metadata
- Design System: Complete DS implementation with JetBrains Mono typography
- Current Branch:
development - Main Branch:
master - Latest Release: Production-ready (September 2024)
- Total Codebase: 147 Swift files with comprehensive features
- Status: App Store ready with complete localization and deployment automation
ARCHITECTURE.md: Complete technical architecture and design patternsDEPLOYMENT.md: Production deployment guide with Fastlane automationAiCoach.md: AI Coach implementation details and coaching algorithmsplanSept5.md: Development milestones and feature completion statusCONTRIBUTING.md: Complete contributor guide with localization requirementsfastlane/metadata/: 5-language App Store metadata (production-ready)
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs or request features via GitHub Issues
- Discussions: Join community discussions
- Email: Contact us at roberdan@fightthestroke.org
- Built with β€οΈ by the Fight the Stroke team
- Inspired by the need for privacy-focused health tracking
- Thanks to the Swift and iOS development community
Current State (September 2024): Production-ready iOS app with critical fixes applied, featuring 147 Swift files of comprehensive functionality.
Architecture: Modern SwiftUI + SwiftData with CloudKit sync, complete AI Coach system, premium features, and privacy-first design.
Recent Critical Fixes:
- HealthKit and notification permissions properly configured
- Complete localization fixes across all 5 languages
- Sync coordinator optimizations for cross-device reliability
- Production-ready deployment pipeline with automated metadata
Deployment: App Store ready with complete fastlane automation, 5-language metadata, and all critical issues resolved.
Disclaimer: This app is designed to help track smoking habits and should not replace professional medical advice. Please consult healthcare professionals for smoking cessation guidance.
βWe live in a twilight world, and there are no friends at dusk.β - Tenet