-
Notifications
You must be signed in to change notification settings - Fork 0
Directory and Module Boundaries
The Xcode Screen-Remote group and the Screen-Remote/ directory currently contain most application sources side by side. Several files combine unrelated responsibilities: DeviceManagementViews.swift, NativeScrcpySession.swift, Models.swift, SettingsView.swift, ScreenSessionManager.swift, VirtualDevices.swift, and others are large. This is a known structure to migrate, not a reason to use extensions in the same file as a cosmetic split.
| Target location | Owns | Must not own |
|---|---|---|
App/ |
app entry, dependency environment, root navigation | feature operations or protocol parsing |
Core/ |
stable models, semantic UI tokens, localization, logging, utilities | feature-specific ADB commands |
Platform/ |
macOS availability wrappers, windows, menu bar, panels | device business rules |
Services/ADB/ |
ADB client, target, errors, helper runtime | SwiftUI screens |
Services/Scrcpy/ |
protocol, server/session lifecycle, media, control transport | feature navigation |
Features/<Feature>/ |
feature views, view models, feature services and models | shared transport duplication |
Resources/ |
assets, Localizable.xcstrings, bundled resources |
Swift source |
- Split
DeviceManagementViews.swiftintoManagement/Files,Processes,PortForwarding, andDeviceActions; move shared ADB process execution intoServices/ADB. - Keep
NativeScrcpySessionas a thin orchestrator; extract server launch, ordered socket connector, metadata/headers, H264 decoder, audio pipeline, control channel, and session state machine. - Split
Models.swiftby Device, Session, Settings, Apps, and VirtualDevice models; split design tokens/components/modifiers instead of growingDesignSystem.swift.
Move files and Xcode references together; a virtual Xcode group while files remain flat is not complete. The initial move must preserve behavior and access control. Do feature changes in a separate change after compilation and path checks prove the relocation is sound.
Swift files are preferably at most 400 lines. At 500 lines, review whether responsibilities have mixed. At 700 lines, split before adding ordinary functionality; any exception needs an explicit, documented allowlist reason.