How lihaoyun6/quickrecorder works
Main Components
• User Interface (UI) Module: Represented by files like QuickRecorderApp.swift and many SwiftUI view files in the ViewModel folder (ContentView, SettingsView, etc.). This module handles the primary user interactions, application settings, and display features (status bar, main panel, preview view).
• Recording Engine: Core functional files such as RecordEngine.swift and AVContext.swift that manage screen capture, audio mix, and video capture.
• Utility and Support Modules: Located inside the Supports folder (AppleScript.swift, Sparkle.swift, SleepPreventer.swift, etc.). These provide additional functionalities like automation/scripting, external integrations (Sparkle for updates), and OS-level support.
• Assets and Resources: The Assets.xcassets directory, localization folders (Base.lproj, it.lproj, zh-Hans.lproj, zh-Hant.lproj), and configuration files (Info.plist, QuickRecorder.entitlements) hold all UI images, localized strings, and basic settings.
• External Libraries/Dependencies: Noted in the README (KeyboardShortcuts, SwiftLAME) which are used for handling shortcut keys and MP3 output respectively.
• Xcode Project and Build Infrastructure: The QuickRecorder.xcodeproj folder and related configuration files represent the project’s setup for building and testing.
Relationships and Interactions
• The UI Module sends user commands (e.g., “start recording,” “open settings”) to the Recording Engine.
• The Recording Engine interfaces with macOS AV frameworks (as suggested by files like AVContext.swift) to initiate video and audio capture and manage post-recording operations such as the optional audio track splitting.
• Utility modules interact with both the UI and core engine to manage support features such as AppleScript integration, window inspecting/highlighting (WindowAccessor.swift and WindowHighlighter.swift), and preventing the screen from sleeping during recording.
• External libraries are integrated within the respective modules (e.g., KeyboardShortcuts for handling hotkeys in the UI, SwiftLAME for encoding audio).
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly separates UI (ViewModel folder and main app file), core processing (RecordEngine.swift, AVContext.swift), and support utilities (Supports folder) to improve maintainability.
• Modular Design: Dividing functionalities into discreet modules (e.g., handling visuals, audio recording, scripting, and settings) suggests a modular, extensible architecture.
• Integration with External Services: The pull in of open-source libraries and usage of system-level libraries (AVFoundation) are significant aspects of the design.