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
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

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

jobs:
test:
name: Tests (macOS)
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Toolchain
run: |
xcodebuild -version
swift --version
- name: Run tests
run: swift test
env:
MUSCLEMAP_SNAPSHOT_FAILURES: ${{ runner.temp }}/snapshot-failures
- name: Upload failed snapshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-snapshots
path: ${{ runner.temp }}/snapshot-failures
if-no-files-found: ignore

ios:
name: iOS build
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Build library
run: xcodebuild -scheme MuscleMap -destination 'generic/platform=iOS Simulator' build
- name: Build demo app
run: |
xcodebuild -project Example/MuscleMapDemoApp.xcodeproj -scheme MuscleMapDemoApp \
-destination 'generic/platform=iOS Simulator' build

podspec:
name: CocoaPods lint
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Lint podspec
run: pod lib lint MuscleMap.podspec --allow-warnings
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ DerivedData/
.swiftpm/xcode/xcuserdata/
.netrc
TODO.md
Tools/ScreenshotGenerator/.build
46 changes: 46 additions & 0 deletions Example/MuscleMapDemoApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,49 @@ struct SubGroupsDemo: View {
}
.padding(.horizontal)

Text("Back Regions")
.font(.headline)

Text("Upper and lower trapezius, rhomboids, rear deltoid and rotator cuff.")
.font(.caption)
.foregroundStyle(.secondary)
.multilineTextAlignment(.center)

HStack(spacing: 16) {
ForEach(BodyGender.allCases, id: \.self) { gender in
BodyView(gender: gender, side: .back)
.showSubGroups()
.highlight(.upperTrapezius, color: .orange)
.highlight(.rhomboids, color: .red)
.highlight(.lowerTrapezius, color: .purple)
.highlight(.rearDeltoid, color: .blue)
.highlight(.rotatorCuff, color: .teal)
.selected(selectedMuscle)
.onMuscleSelected { muscle, _ in
selectedMuscle = muscle
}
.frame(height: 350)
}
}
.padding(.horizontal)

HStack(spacing: 12) {
ForEach([(Muscle.upperTrapezius, Color.orange), (.rhomboids, .red), (.lowerTrapezius, .purple), (.rearDeltoid, .blue), (.rotatorCuff, .teal)], id: \.0) { muscle, color in
HStack(spacing: 4) {
Circle().fill(color).frame(width: 8, height: 8)
Text(muscle.displayName).font(.caption2)
}
}
}
.padding(.horizontal)

if let muscle = selectedMuscle {
VStack(spacing: 4) {
Text(muscle.displayName)
.font(.title3.bold())
Text("Drawn on: \(drawnViews(of: muscle))")
.font(.caption)
.foregroundStyle(.secondary)
if muscle.isSubGroup, let parent = muscle.parentGroup {
Text("Sub-group of \(parent.displayName)")
.font(.caption)
Expand All @@ -684,6 +723,13 @@ struct SubGroupsDemo: View {
.navigationTitle("Sub-Groups")
}
}

private func drawnViews(of muscle: Muscle) -> String {
BodySide.allCases
.filter { side in BodyGender.allCases.contains { muscle.isDrawable(gender: $0, side: side) } }
.map(\.displayName)
.joined(separator: ", ")
}
}

#Preview {
Expand Down
Loading
Loading