This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PCVolumeControl is an iOS application that allows users to remotely control application audio volumes on a Windows PC. The app connects to a server running on the PC through a TCP connection and provides a UI to adjust volume levels for individual applications.
- Platform: iOS 17+ Swift app using SwiftUI
- Architecture Pattern: MVVM (Model-View-ViewModel)
- Networking: TCP socket communication using Apple's Network framework
- Protocol: JSON-based protocol (version 7) for client-server communication
-
Connection Management:
MainViewModel.swift: Handles TCP socket connection, error handling, and data processing- Connection states: ready, preparing, failed, waiting, cancelled
-
Data Models:
FullState: Server response with complete state informationSession: Represents an application with volume and mute state- Various update models for sending changes to the server
-
UI Components:
MainView: Initial connection screenSliderView: Volume controls for applicationsConnectingView: Connection status display
-
Open the project in Xcode:
open PcVolumeControl.xcodeproj -
Select a target device or simulator
-
Build and run the app using Xcode's run button or:
⌘+R
unit tests
Run this to execute all unit tests: xcodebuild test -scheme PcVolumeControl -destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.0'
The project uses periphery to detect unused code.
- Install (one-time):
brew install peripheryapp/periphery/periphery - Run the scan from the repo root:
periphery scan
In CI this runs as the periphery fastlane lane (bundle exec fastlane periphery),
which adds --strict so the scan exits non-zero on findings. The
.github/workflows/ci.yml workflow runs it on every push and pull request.
Configuration lives in the committed .periphery.yml; periphery scan reads it
automatically. A clean run reports No unused code detected.. Notes:
retain_codable_properties: truekeeps the encode-only wire DTOs inmodels/VolumeUpdateDTOs.swiftfrom being flagged (their properties are written to JSON but never read back, which is not dead code).report_excludecovers the widget scaffolding (AppIntent.swift,PcVolumeControlWidgetControl.swift,PcVolumeControlWidgetLiveActivity.swift) kept for planned widget work, andSnapshotHelper.swift, which is vendored verbatim from fastlane and must not be hand-edited.- The scan requires a single shared
PcVolumeControlscheme. A stale per-user scheme underxcodeproj/xcuserdata/.../xcschemes/creates a duplicate that makes periphery fail with "Scheme ... does not exist"; delete it (it is git-ignored and regenerated by Xcode).
- The project is undergoing refactoring (branch: bill/refactor)
- Recently migrated to SwiftUI from an older architecture
- Pods dependencies have been removed
- NEVER use emojis in the code, including in comments.
The app communicates with the PC server using a JSON protocol:
- Server → Client: Sends
FullStatewith all devices and sessions information - Client → Server: Sends updates for:
- Default device changes
- Master volume/mute changes
- Individual application volume/mute changes