# ddakal/musicmarker architecture

> Architecture diagram of the GitHub repository ddakal/musicmarker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ddakal/musicmarker
- Repository: https://github.com/ddakal/musicmarker

## Overview

Music Marker lets dancers select a music file, play it with adjustable speed, and save or use playback markers from iPhone or Apple Watch. The iPhone is the primary playback and music-management runtime; its player coordinates audio, marker, watch-connectivity, and media-control services. The watch presents the synced library and sends playback and marker commands back to the iPhone. The README documents these product capabilities, while sampled source and the SOURCE INDEX support only some internal call paths; unverified cross-device wiring is shown as dashed.

Main entry points: [`DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift) (Player coordinator), [`DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/ViewModel/WatchViewModel.swift) (Watch coordinator), [`DancingMarker/WatchDancingMarker Watch App/View/WatchPlaying/WatchPlayingView.swift`](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchPlaying/WatchPlayingView.swift) (Watch playback), [`DancingMarker/DancingMarker/NavigationManager.swift`](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/NavigationManager.swift) (iPhone navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ios_ui["iPhone experience"]
  node_ios_entry["iPhone app"]
  node_ios_navigation["iPhone navigation"]
  node_music_library["Music library"]
  node_music_picker["Music selection"]
  node_music_editor["Music editor"]
  node_ios_play_view["Playback interface"]
end

subgraph group_ios_runtime["Playback runtime"]
  node_player_vm["Player coordinator"]
  node_music_model[("Music records<br/>[Music.swift]")]
  node_music_data["Music data<br/>[MusicData.swift]"]
  node_audio_service["Audio playback<br/>[AudioService.swift]"]
  node_marker_service["Marker operations"]
  node_watch_ios_service["iPhone watch link<br/>[WatchService.swift]"]
  node_media_controls["Media controls"]
end

subgraph group_watch_app["Watch experience"]
  node_watch_entry["Watch app"]
  node_watch_navigation["Watch navigation"]
  node_watch_library["Watch music list"]
  node_watch_play_view["Watch playback"]
  node_watch_markers["Watch markers"]
end

subgraph group_watch_runtime["Watch runtime"]
  node_watch_vm["Watch coordinator"]
  node_watch_communication["Watch commands"]
  node_watch_sync["Watch syncing"]
  node_watch_data["Watch data"]
  node_watch_timer["Watch timer"]
end

node_dancer(("Dancer"))
node_watch_user(("Watch user"))

node_dancer -->|"opens"| node_ios_entry
node_ios_entry -.->|"routes"| node_ios_navigation
node_ios_navigation -->|"renders"| node_music_library
node_ios_navigation -->|"renders"| node_ios_play_view
node_music_library -.->|"selects music"| node_music_picker
node_music_library -.->|"edits music"| node_music_editor
node_ios_play_view -->|"controls"| node_player_vm
node_player_vm -->|"controls audio"| node_audio_service
node_player_vm -->|"manages markers"| node_marker_service
node_player_vm -->|"sends updates"| node_watch_ios_service
node_player_vm -->|"configures controls"| node_media_controls
node_player_vm -->|"uses music"| node_music_model
node_player_vm -->|"uses data"| node_music_data
node_dancer -->|"opens"| node_watch_entry
node_watch_entry -.->|"routes"| node_watch_navigation
node_watch_navigation -->|"renders"| node_watch_library
node_watch_navigation -->|"renders"| node_watch_play_view
node_watch_library -.->|"uses state"| node_watch_vm
node_watch_play_view -->|"controls"| node_watch_vm
node_watch_play_view -->|"opens"| node_watch_markers
node_watch_markers -->|"uses state"| node_watch_vm
node_watch_vm -->|"sends commands"| node_watch_communication
node_watch_vm -->|"syncs library"| node_watch_sync
node_watch_vm -->|"loads music"| node_watch_data
node_watch_vm -->|"manages timer"| node_watch_timer
node_watch_user -->|"controls"| node_watch_play_view
node_watch_communication -.->|"sends commands"| node_watch_ios_service
node_watch_sync -.->|"requests library"| node_watch_ios_service

click node_ios_entry "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Application/DancingMarkerApp.swift"
click node_ios_navigation "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/NavigationManager.swift"
click node_music_library "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/MusicListView.swift"
click node_music_picker "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/SelectGalleryView.swift"
click node_music_editor "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/MusicEdit/MusicEditView.swift"
click node_ios_play_view "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/NowPlayingView.swift"
click node_player_vm "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift"
click node_music_model "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Models/Music.swift"
click node_music_data "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Models/MusicData.swift"
click node_audio_service "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/AudioService.swift"
click node_marker_service "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/MarkerService.swift"
click node_watch_ios_service "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/WatchService.swift"
click node_media_controls "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/LiveActivityService.swift"
click node_watch_entry "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Application/WatchDancingMarkerApp.swift"
click node_watch_navigation "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Application/WatchNavigationManager.swift"
click node_watch_library "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchMain/WatchMusicListView.swift"
click node_watch_play_view "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchPlaying/WatchPlayingView.swift"
click node_watch_markers "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchMarkerList/WatchMarkerListView.swift"
click node_watch_vm "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/ViewModel/WatchViewModel.swift"
click node_watch_communication "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchCommunicationService.swift"
click node_watch_sync "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchSyncService.swift"
click node_watch_data "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchDataService.swift"
click node_watch_timer "https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchTimerService.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ios_entry,node_ios_navigation,node_music_library,node_music_picker,node_music_editor,node_ios_play_view,node_watch_user toneBlue
class node_player_vm,node_music_model,node_music_data,node_audio_service,node_marker_service,node_watch_ios_service,node_media_controls toneAmber
class node_watch_entry,node_watch_navigation,node_watch_library,node_watch_play_view,node_watch_markers toneMint
class node_watch_vm,node_watch_communication,node_watch_sync,node_watch_data,node_watch_timer toneRose
class node_dancer toneIndigo
```

## Components

### iPhone experience

- [iPhone app](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Application/DancingMarkerApp.swift): `DancingMarker/DancingMarker/Application/DancingMarkerApp.swift`
- [iPhone navigation](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/NavigationManager.swift): `DancingMarker/DancingMarker/NavigationManager.swift`
- [Music library](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/MusicListView.swift): `DancingMarker/DancingMarker/View/Main/MusicListView.swift`
- [Music selection](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/SelectGalleryView.swift): `DancingMarker/DancingMarker/View/Main/SelectGalleryView.swift`
- [Music editor](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/MusicEdit/MusicEditView.swift): `DancingMarker/DancingMarker/View/Main/MusicEdit/MusicEditView.swift`
- [Playback interface](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/View/Main/NowPlayingView.swift): `DancingMarker/DancingMarker/View/Main/NowPlayingView.swift`

### Playback runtime

- [Player coordinator](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift): `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`
- [Music records](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Models/Music.swift): `DancingMarker/DancingMarker/Models/Music.swift`
- [Music data](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Models/MusicData.swift): `DancingMarker/DancingMarker/Models/MusicData.swift`
- [Audio playback](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/AudioService.swift): `DancingMarker/DancingMarker/Services/AudioService.swift`
- [Marker operations](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/MarkerService.swift): `DancingMarker/DancingMarker/Services/MarkerService.swift`
- [iPhone watch link](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/WatchService.swift): `DancingMarker/DancingMarker/Services/WatchService.swift`
- [Media controls](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/DancingMarker/Services/LiveActivityService.swift): `DancingMarker/DancingMarker/Services/LiveActivityService.swift`

### Watch experience

- [Watch app](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Application/WatchDancingMarkerApp.swift): `DancingMarker/WatchDancingMarker Watch App/Application/WatchDancingMarkerApp.swift`
- [Watch navigation](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Application/WatchNavigationManager.swift): `DancingMarker/WatchDancingMarker Watch App/Application/WatchNavigationManager.swift`
- [Watch music list](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchMain/WatchMusicListView.swift): `DancingMarker/WatchDancingMarker Watch App/View/WatchMain/WatchMusicListView.swift`
- [Watch playback](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchPlaying/WatchPlayingView.swift): `DancingMarker/WatchDancingMarker Watch App/View/WatchPlaying/WatchPlayingView.swift`
- [Watch markers](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/View/WatchMarkerList/WatchMarkerListView.swift): `DancingMarker/WatchDancingMarker Watch App/View/WatchMarkerList/WatchMarkerListView.swift`

### Watch runtime

- [Watch coordinator](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/ViewModel/WatchViewModel.swift): `DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`
- [Watch commands](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchCommunicationService.swift): `DancingMarker/WatchDancingMarker Watch App/Services/WatchCommunicationService.swift`
- [Watch syncing](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchSyncService.swift): `DancingMarker/WatchDancingMarker Watch App/Services/WatchSyncService.swift`
- [Watch data](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchDataService.swift): `DancingMarker/WatchDancingMarker Watch App/Services/WatchDataService.swift`
- [Watch timer](https://github.com/ddakal/musicmarker/blob/Develop/DancingMarker/WatchDancingMarker%20Watch%20App/Services/WatchTimerService.swift): `DancingMarker/WatchDancingMarker Watch App/Services/WatchTimerService.swift`

### Other components

- **Dancer**
- **Watch user**

## Connections

- Dancer → iPhone app: opens (evidence: `README.md`)
- iPhone app → iPhone navigation: routes
- iPhone navigation → Music library: renders (evidence: `DancingMarker/DancingMarker/NavigationManager.swift`)
- iPhone navigation → Playback interface: renders (evidence: `DancingMarker/DancingMarker/NavigationManager.swift`)
- Music library → Music selection: selects music
- Music library → Music editor: edits music
- Playback interface → Player coordinator: controls (evidence: `DancingMarker/DancingMarker/View/Main/NowPlayingView.swift`)
- Player coordinator → Audio playback: controls audio (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Player coordinator → Marker operations: manages markers (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Player coordinator → iPhone watch link: sends updates (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Player coordinator → Media controls: configures controls (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Player coordinator → Music records: uses music (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Player coordinator → Music data: uses data (evidence: `DancingMarker/DancingMarker/ViewModel/PlayerViewModel.swift`)
- Dancer → Watch app: opens (evidence: `README.md`)
- Watch app → Watch navigation: routes
- Watch navigation → Watch music list: renders (evidence: `DancingMarker/WatchDancingMarker Watch App/Application/WatchNavigationManager.swift`)
- Watch navigation → Watch playback: renders (evidence: `DancingMarker/WatchDancingMarker Watch App/Application/WatchNavigationManager.swift`)
- Watch music list → Watch coordinator: uses state (evidence: `DancingMarker/WatchDancingMarker Watch App/View/WatchMain/WatchMusicListView.swift`)
- Watch playback → Watch coordinator: controls (evidence: `DancingMarker/WatchDancingMarker Watch App/View/WatchPlaying/WatchPlayingView.swift`)
- Watch playback → Watch markers: opens (evidence: `DancingMarker/WatchDancingMarker Watch App/View/WatchPlaying/WatchPlayingView.swift`)
- Watch markers → Watch coordinator: uses state (evidence: `DancingMarker/WatchDancingMarker Watch App/View/WatchMarkerList/WatchMarkerListView.swift`)
- Watch coordinator → Watch commands: sends commands (evidence: `DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`)
- Watch coordinator → Watch syncing: syncs library (evidence: `DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`)
- Watch coordinator → Watch data: loads music (evidence: `DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`)
- Watch coordinator → Watch timer: manages timer (evidence: `DancingMarker/WatchDancingMarker Watch App/ViewModel/WatchViewModel.swift`)
- Watch user → Watch playback: controls (evidence: `README.md`)
- Watch commands → iPhone watch link: sends commands
- Watch syncing → iPhone watch link: requests library
