Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
swiftpm:
name: SwiftPM (build + test)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Setup mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1

- name: Build
run: mise run build

- name: Test
run: mise run test

ios:
name: iOS (xcodebuild)
runs-on: macos-latest

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Setup mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1

- name: Install xcodegen
run: brew install xcodegen

- name: Build (Dev scheme)
run: mise run ios:build:dev

- name: Build (Prod scheme)
if: github.ref == 'refs/heads/main'
run: mise run ios:build:prod
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release Please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
draft:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
with:
token: ${{ github.token }}
release-type: node
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Swift Package Manager
.build/
*.swiftpm
.swiftpm/

# Xcode
xcuserdata/
*.xcodeproj
*.xcworkspace
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
*~.nib
DerivedData/

# Build artifacts
*.o
*.a
*.dylib
*.framework
*.app
*.ipa
*.dSYM.zip
*.dSYM

# macOS
.DS_Store
.AppleDouble
.LSOverride

# Temporary files
*.swp
*.swo
*~
.tmp/
tmp/
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "Use conventional commit format: type(scope): description."
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions Apps/iOS/BetterFitApp/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"images": [
{
"idiom": "iphone",
"size": "20x20",
"scale": "2x",
"filename": "AppIcon-40.png"
},
{
"idiom": "iphone",
"size": "20x20",
"scale": "3x",
"filename": "AppIcon-60.png"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "2x",
"filename": "AppIcon-58.png"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "3x",
"filename": "AppIcon-87.png"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "2x",
"filename": "AppIcon-80.png"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "3x",
"filename": "AppIcon-120.png"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "2x",
"filename": "AppIcon-120.png"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "3x",
"filename": "AppIcon-180.png"
},
{
"idiom": "ipad",
"size": "20x20",
"scale": "1x",
"filename": "AppIcon-20.png"
},
{
"idiom": "ipad",
"size": "20x20",
"scale": "2x",
"filename": "AppIcon-40.png"
},
{
"idiom": "ipad",
"size": "29x29",
"scale": "1x",
"filename": "AppIcon-29.png"
},
{
"idiom": "ipad",
"size": "29x29",
"scale": "2x",
"filename": "AppIcon-58.png"
},
{
"idiom": "ipad",
"size": "40x40",
"scale": "1x",
"filename": "AppIcon-40.png"
},
{
"idiom": "ipad",
"size": "40x40",
"scale": "2x",
"filename": "AppIcon-80.png"
},
{
"idiom": "ipad",
"size": "76x76",
"scale": "1x",
"filename": "AppIcon-76.png"
},
{
"idiom": "ipad",
"size": "76x76",
"scale": "2x",
"filename": "AppIcon-152.png"
},
{
"idiom": "ipad",
"size": "83.5x83.5",
"scale": "2x",
"filename": "AppIcon-167.png"
},
{
"idiom": "ios-marketing",
"size": "1024x1024",
"scale": "1x",
"filename": "AppIcon-1024.png"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
6 changes: 6 additions & 0 deletions Apps/iOS/BetterFitApp/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info": {
"author": "xcode",
"version": 1
}
}
13 changes: 13 additions & 0 deletions Apps/iOS/BetterFitApp/BetterFitApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import BetterFit
import SwiftUI

@main
struct BetterFitApp: App {
let betterFit = BetterFit()

var body: some Scene {
WindowGroup {
ContentView(betterFit: betterFit)
}
}
}
68 changes: 68 additions & 0 deletions Apps/iOS/BetterFitApp/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import BetterFit
import SwiftUI

struct ContentView: View {
let betterFit: BetterFit

@State private var lastEvent: String = ""
@State private var recoveryPercent: Double = 0

var body: some View {
NavigationStack {
List {
Section("Status") {
LabeledContent("Overall recovery") {
Text("\(Int(recoveryPercent))%")
.monospacedDigit()
}

if !lastEvent.isEmpty {
LabeledContent("Last event") {
Text(lastEvent)
}
}
}

Section("Quick actions") {
Button("Simulate workout + update recovery") {
simulateWorkout()
}
}
}
.navigationTitle("BetterFit")
}
.onAppear {
refreshRecovery()
}
}

private func refreshRecovery() {
recoveryPercent = betterFit.bodyMapManager.getOverallRecoveryPercentage()
}

private func simulateWorkout() {
// Minimal "fake" workout flow just to prove the library runs in an app.
let benchPress = Exercise(
name: "Bench Press",
equipmentRequired: .barbell,
muscleGroups: [.chest, .triceps]
)

let workout = Workout(
name: "Quick Session",
exercises: [
WorkoutExercise(exercise: benchPress, sets: [ExerciseSet(reps: 8, weight: 60)])
]
)

betterFit.startWorkout(workout)
betterFit.completeWorkout(workout)

lastEvent = "Completed workout"
refreshRecovery()
}
}

#Preview {
ContentView(betterFit: BetterFit())
}
43 changes: 43 additions & 0 deletions Apps/iOS/BetterFitApp/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>BetterFit Dev</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string></string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchScreen</key>
<dict/>
</dict>
</plist>
Loading