Skip to content

Implement BetterFit iOS strength training coach core framework#1

Merged
johnnyhuy merged 13 commits intomainfrom
copilot/add-core-features-for-betterfit
Dec 24, 2025
Merged

Implement BetterFit iOS strength training coach core framework#1
johnnyhuy merged 13 commits intomainfrom
copilot/add-core-features-for-betterfit

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 6, 2025

Swift Package Manager framework implementing an iOS/watchOS strength training coach with auto-tracking, AI adaptation, and social features.

Architecture

Models (6 files)

  • Exercise, Workout, WorkoutTemplate - Core workout data structures
  • TrainingPlan with TrainingGoal enum (strength, hypertrophy, endurance, powerlifting, general fitness, weight loss)
  • BodyMapRecovery - Time-based recovery tracking across 7 body regions with 4 states
  • UserProfile, Challenge, Streak - Social features with 4 challenge goal types

Services (3 files)

  • AutoTrackingService - Watch accelerometer/gyroscope rep detection via motion magnitude thresholds
  • AIAdaptationService - Analyzes completion rate, progressive overload, plateau detection
  • EquipmentImageService - 3D/AI equipment image library with async generation support

Features (7 managers)

  • PlanManager - Multi-week training plan management
  • TemplateManager - Template CRUD, tag/name search, recent templates
  • EquipmentSwapManager - Alternative exercise suggestions based on available equipment
  • BodyMapManager - Recovery recommendations, overall recovery percentage
  • SocialManager - Streak tracking, challenge leaderboards
  • SmartNotificationManager - Optimal workout time detection, overtraining alerts

Usage

let betterFit = BetterFit()

// Create workout from template with equipment swaps
var workout = betterFit.templateManager.createWorkout(from: templateId)!
let swaps = betterFit.equipmentSwapManager.suggestSwaps(for: workout)
if let alt = swaps.first?.alternatives.first {
    betterFit.equipmentSwapManager.applySwap(
        workout: &workout,
        originalExerciseId: swaps.first!.original.id,
        newExercise: alt
    )
}

// Auto-track with Watch sensors
betterFit.startWorkout(workout)
let event = betterFit.processMotionData(
    MotionData(acceleration: [x, y, z], rotation: [rx, ry, rz])
)

// Complete workout (updates recovery, streak, AI analysis)
betterFit.completeWorkout(workout)

Recovery System Behavior

When multiple muscle groups map to the same body region (e.g., quads + glutes → legs), recovery status compounds per workout: recovered → fatigued → sore. This prevents over-training specific regions.

Test Coverage

30 tests across models, services, features, and integration flows. Swift Package Manager project targeting iOS 17+, watchOS 10+.

Original prompt

BetterFit is an open-source strength training coach for iOS and Apple Watch. It auto-tracks sets and reps via Watch sensors, adapts plans with AI, and uses clean consistent 3D/AI equipment images. Core features: plan mode, reusable workout templates, fast swaps for available equipment, body-map recovery view, social streaks and challenges, and smart notifications that minimise gym admin time.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 6, 2025 14:31
…e features

Co-authored-by: johnnyhuy <27847622+johnnyhuy@users.noreply.github.com>
Co-authored-by: johnnyhuy <27847622+johnnyhuy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add core features for BetterFit strength training coach Implement BetterFit iOS strength training coach core framework Dec 6, 2025
Copilot AI requested a review from johnnyhuy December 6, 2025 14:36
…g main app entry, content view, and project configuration
feat(docs): add CONTRIBUTING.md for development setup and guidelines
chore(docs): remove outdated iOS README and update links in main README
chore(docs): create new documentation for running the app and troubleshooting
chore(docs): enhance API and usage examples with additional details
chore(mise): update build commands to streamline project generation and building
@johnnyhuy johnnyhuy marked this pull request as ready for review December 24, 2025 05:08
@johnnyhuy johnnyhuy merged commit a99d7f6 into main Dec 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants