How atpugvaraa/cisum works
Purpose and Targets
Cisum is a native Swift/SwiftUI music-player application with shared product logic and separate iOS and macOS hosts. It supports music discovery/search, playback and now-playing surfaces, playlist library/import, caching, and platform-integrated lyrics/live activities.
Application Entry Points
• iOS app bootstrap: iOS/cisum/iOSApp.swift; its root UI is iOS/cisum/Views/ContentView.swift.
• macOS host: macOS/cisum/macOSApp.swift and macOS/cisum/ContentView.swift.
• The iOS Lyrics extension/widget target is rooted at iOS/Lyrics/LyricsBundle.swift, with Live Activity and control implementations in iOS/Lyrics/LyricsLiveActivity.swift and iOS/Lyrics/LyricsControl.swift.
• Shared startup/service wiring is centralized in Shared/Core/Services/AppBootstrap.swift.
Shared State, Navigation, and Presentation
SwiftUI observable view models coordinate major screens: Shared/Core/Observables/HomeViewModel.swift, Shared/Core/Observables/SearchViewModel.swift, and Shared/Core/Observables/PlayerViewModel.swift. Navigation is abstracted from screens through Shared/Navigation/Router.swift and injected via Shared/Core/Helpers/EnvironmentKeys/RouterEnvironmentKey.swift. Player UI is intentionally reusable across surfaces through Shared/Player/PlayerSurfaces.swift, Shared/Player/NowPlayingView.swift, and Shared/Player/DynamicPlayerIsland.swift.
Discovery and Search Flow
The iOS tab/screen layer exposes Home, Discover, Search, and Library; representative roots are iOS/cisum/Views/Home/HomeView.swift, iOS/cisum/Views/Discover/DiscoverView.swift, and iOS/cisum/Views/Search/SearchView.swift. Search state feeds persistent/history and cache-hint services (Shared/Core/Services/SearchHistoryStore.swift, Shared/Core/Services/SearchCacheHintStore.swift) plus cached result storage in Shared/Caching/SearchResultsCache.swift. Suggestions are ranked at the service boundary by Shared/Core/Services/SuggestionRanker.swift.
Playback and Media Pipeline
PlayerViewModel is the primary control boundary between UI and playback state. Playback views use shared controls/sliders and consume artwork/metadata helpers. Metadata is normalized before presentation (Shared/Core/Helpers/MusicMetadataNormalizer.swift); video metadata can be cached (Shared/Caching/VideoMetadataCache.swift). Artwork processing, dominant-color extraction, and cache persistence are separated into Shared/Core/Services/ArtworkVideoProcessor.swift, Shared/Core/Services/ArtworkDominantColorExtractor.swift, and Shared/Core/Services/MediaCacheStore.swift. System-oriented controls include AirPlay and volume-button skipping (Shared/Components/Buttons/AirPlayButton.swift, Shared/Core/Services/VolumeButtonSkipController.swift).
Library and YouTube Import
Library persistence is modeled around playlists and playlist items (Shared/Core/Models/CisumPlaylist.swift, Shared/Core/Models/CisumPlaylistItem.swift) and managed by Shared/Core/Services/PlaylistLibraryStore.swift. The library UI and detail view are iOS/cisum/Views/Library/LibraryView.swift and Shared/Library/PlaylistDetailView.swift. YouTube playlist import is a staged boundary: UI sheet → Shared/Core/Services/YouTubePlaylistImportService.swift → job persistence in Shared/Core/Services/PlaylistImportJobStore.swift, using candidate/job/track entry models.
Infrastructure and Platform Boundaries
The project is built through separate Xcode projects/workspace: iOS/iOS.xcodeproj, macOS/macOS.xcodeproj, and cisum.xcworkspace. Swift Package dependencies are lockfile-managed under cisum.xcworkspace/xcshareddata/swiftpm/Package.resolved. iOS capabilities are declared in iOS/cisum/cisum.entitlements; the network condition boundary is monitored by Shared/Core/Services/NetworkPathMonitor.swift. Shared asset catalogs supply player imagery and icons in Shared/Assets/Assets.xcassets.
Main entry points: PlayerViewModel.swift Player View Model · AppBootstrap.swift App Bootstrap · HomeViewModel.swift Screen View Models · ContentView.swift iOS Root UI
Components 20
App Hosts
- iOS App
iOS/cisum/iOSApp.swift - iOS Root UI
iOS/cisum/Views/ContentView.swift - macOS App
macOS/cisum/macOSApp.swift
Shared UI & State
- Router · Injected navigation boundary for screens.
Shared/Navigation/Router.swift - Screen View Models · Home, search, and player presentation state.
Shared/Core/Observables/HomeViewModel.swift - Discovery Screens · Home, Discover, and Search entry surfaces.
iOS/cisum/Views/Home/HomeView.swift - Player Surfaces · Now-playing and dynamic player island UI.
Shared/Player/PlayerSurfaces.swift - Player View Model · Primary UI control boundary for playback state.
Shared/Core/Observables/PlayerViewModel.swift - Library UI · Library and playlist detail presentation.
iOS/cisum/Views/Library/LibraryView.swift
Domain Services
- App Bootstrap · Central shared startup and service composition.
Shared/Core/Services/AppBootstrap.swift - Search Services · History, cache hints, and suggestion ranking.
Shared/Core/Services/SearchHistoryStore.swift - Search Results Cache
Shared/Caching/SearchResultsCache.swift - Media Pipeline · Normalizes metadata and processes artwork colors.
Shared/Core/Helpers/MusicMetadataNormalizer.swift - Media Cache Store
Shared/Core/Services/MediaCacheStore.swift - Playlist Library Store · Manages playlist and playlist-item models.
Shared/Core/Services/PlaylistLibraryStore.swift - YouTube Playlist Import · Creates persisted playlist import jobs from UI requests.
Shared/Core/Services/YouTubePlaylistImportService.swift - Import Job Store
Shared/Core/Services/PlaylistImportJobStore.swift
Platform Integration
- Lyrics Extension · Live Activity and control target.
iOS/Lyrics/LyricsBundle.swift - System Playback Controls · AirPlay and volume-button skip integration.
Shared/Core/Services/VolumeButtonSkipController.swift - Network Path Monitor
Shared/Core/Services/NetworkPathMonitor.swift
Connections 21
- iOS App → iOS Root UI: hosts
- iOS App → App Bootstrap: starts
- macOS App → App Bootstrap: starts
- App Bootstrap → Router: wires
- App Bootstrap → Screen View Models: wires
- iOS Root UI → Discovery Screens: presents
- Discovery Screens → Router: navigates via
- Discovery Screens → Screen View Models: binds
- Screen View Models → Search Services: search state
- Search Services → Search Results Cache: reads and writes
- iOS Root UI → Library UI: presents
- Library UI → Playlist Library Store: manages
- Library UI → YouTube Playlist Import: imports
- YouTube Playlist Import → Import Job Store: persists jobs
- Screen View Models → Player View Model: selects media
- Player View Model → Player Surfaces: drives
- Player View Model → Media Pipeline: requests metadata
- Media Pipeline → Media Cache Store: persists media
- Player View Model → System Playback Controls: integrates
- Player View Model → Lyrics Extension: updates now playing
- App Bootstrap → Network Path Monitor: monitors connectivity