Problem
BLEManager.swift is at 2596 lines with a class body spanning 1756 lines. SwiftLint warns at 1000/800 respectively and errors at 2600. We're 4 lines from the error threshold — any new feature will trip it.
Suggested approach
Extract coherent sections into dedicated managers:
- Command queue logic (~200 lines) —
queueCommand, processCommandQueue, startCommandQueueTimer, rate limiting → BLECommandQueue.swift
- Connection lifecycle (~300 lines) —
connectToGoPro, disconnectFromGoPro, connectStaggered, straggler retry, scheduleReconnectIfNeeded → merge into existing BLEConnectionManager.swift
- Sleep/power-down (~100 lines) —
sendSleepCommand, sendPowerDownCommand, putCamerasToSleep, keep-alive timer → BLESleepManager.swift
- Device query/scan timers (~80 lines) —
startDeviceQueryTimer, startDeviceScanTimer → BLEPollingManager.swift
- Settings sync (~150 lines) —
sendSettings, sendSettingsToCamerasInGroup, queryAllSettings, verifySettings → BLESettingsManager.swift
Acceptance criteria
BLEManager.swift under 800 lines (class body)
- No functional regressions — same behavior, same public API
- Each extracted manager gets its own unit test file
Problem
BLEManager.swiftis at 2596 lines with a class body spanning 1756 lines. SwiftLint warns at 1000/800 respectively and errors at 2600. We're 4 lines from the error threshold — any new feature will trip it.Suggested approach
Extract coherent sections into dedicated managers:
queueCommand,processCommandQueue,startCommandQueueTimer, rate limiting →BLECommandQueue.swiftconnectToGoPro,disconnectFromGoPro,connectStaggered, straggler retry,scheduleReconnectIfNeeded→ merge into existingBLEConnectionManager.swiftsendSleepCommand,sendPowerDownCommand,putCamerasToSleep, keep-alive timer →BLESleepManager.swiftstartDeviceQueryTimer,startDeviceScanTimer→BLEPollingManager.swiftsendSettings,sendSettingsToCamerasInGroup,queryAllSettings,verifySettings→BLESettingsManager.swiftAcceptance criteria
BLEManager.swiftunder 800 lines (class body)