What Are the Main Components of Palmier Pro? A Deep Dive into the Swift Architecture
Palmier Pro is organized into eleven distinct Swift modules—App, Editor, MediaPanel, Preview, Generation, Export, Transcription, Models, UI, Utilities, and Help & Inspector—that form a layered architecture for professional video editing.
The open-source repository palmier-io/palmier-pro implements a macOS video editing application using a hybrid SwiftUI and AppKit architecture. Understanding the main components of Palmier Pro is essential for contributors and developers looking to extend its functionality or integrate with its API. Each module lives under Sources/PalmierPro and encapsulates a specific domain, from real-time preview rendering to speech-to-text transcription.
Architectural Overview
The codebase follows a unidirectional data flow pattern with @Observable view-models synchronizing the UI to the underlying project state. The architecture separates concerns into four logical layers:
- Presentation Layer – App, Editor, MediaPanel, Preview, and Toolbar handle user interaction
- Business Logic Layer – Generation and Transcription process media and extract data
- Data Layer – Models defines the core structures (Timeline, MediaAsset, Keyframe)
- Infrastructure Layer – UI, Utilities, and Export provide cross-cutting concerns
Core Application Layer (App)
The App module manages the application lifecycle, global state, menu bar integration, and update handling. It serves as the entry point and coordinator for the entire system.
Key responsibilities include:
- Application bootstrap via
App/main.swift - Global state management in
App/AppState.swift - Automatic update checking via
App/Updater.swift
The AppState class orchestrates asynchronous project loading. When a user opens a file, AppState.openProject(at:register:) initializes the editor session:
// App/AppState.swift
func openProject(at url: URL, register: Bool = true) {
Task {
do {
try await openProjectAsync(at: url, register: register, options: .init())
} catch {
NSAlert(error: error).runModal()
}
}
}
Editing Interface (Editor)
The Editor module contains the window controller, view hierarchy, and view-model for the main editing canvas. It bridges the AppKit window management with SwiftUI view logic.
Critical files include:
Editor/EditorWindowController.swift– Manages the NSDocument window lifecycleEditor/EditorView.swift– Root SwiftUI view for the editing interfaceEditor/ViewModel/EditorViewModel.swift– Observable object managing the current project state
The EditorViewModel receives launch options from the App layer and configures the initial user experience:
// Editor/ViewModel/EditorViewModel.swift
func apply(_ options: ProjectOpenOptions, to editor: EditorViewModel) {
if options.startTutorial {
DispatchQueue.main.async { editor.tour.start(in: editor) }
}
}
Asset Management (MediaPanel)
The MediaPanel module handles browsing, importing, and organizing media assets including videos, images, audio, and Lottie files. It provides the sidebar interface for project assets and captions.
Key components:
MediaPanel/MediaPanelView.swift– Main container viewMediaPanel/MediaTab/MediaTab.swift– Asset browser interfaceMediaPanel/CaptionsTab/CaptionTab.swift– Subtitle and transcription management
Assets are appended to the project through the EditorViewModel via MediaAsset instances defined in the Models module:
// MediaPanel/MediaTab/AssetThumbnailView.swift
func addAsset(_ asset: MediaAsset) {
project.editorViewModel.mediaAssets.append(asset)
}
Real-Time Rendering (Preview)
The Preview module provides real-time video preview capabilities, timeline rendering, and overlay controls. It maintains the VideoEngine responsible for frame-accurate playback.
Core files:
Preview/PreviewView.swift– SwiftUI wrapper for the rendering surfacePreview/TimelineRenderer.swift– Draws the timeline and clip boundariesPreview/VideoEngine.swift– Low-level video decoding and display
The TimelineRenderer iterates over the clip list from the Timeline model to composite frames:
// Preview/TimelineRenderer.swift
func renderTimeline(_ timeline: Timeline, in context: RenderingContext) {
// Iterate over clips and draw each frame.
timeline.clips.forEach { clip in
// …
}
}
Processing Engine (Generation)
The Generation module handles computationally intensive tasks including video rendering, compression, and editing-specific extractions like trimming. It operates on background queues to maintain UI responsiveness.
Key services:
Generation/GenerationService.swift– High-level rendering coordinatorGeneration/VideoCompressor.swift– Output compression and encodingGeneration/Edit/VideoTrimExtractor.swift– Segment extraction for timeline edits
Output Pipeline (Export)
The Export module converts in-memory VideoProject instances into portable formats including XML, Lottie, and text representations. It serializes the Models layer into industry-standard formats.
Primary exporters:
Export/ExportService.swift– Entry point for all export operationsExport/XMLExporter.swift– Final Cut Pro and Premiere-compatible XML generationExport/PalmierProjectExporter.swift– Native project file serialization
The export flow instantiates format-specific exporters based on target requirements:
// Export/ExportService.swift
func exportProject(_ project: VideoProject, to url: URL) throws {
let exporter = XMLExporter(project: project)
try exporter.write(to: url)
}
Speech Recognition (Transcription)
The Transcription module provides speech-to-text capabilities for video assets, including result caching and full-text search across transcripts.
Key implementations:
Transcription/Transcription.swift– Audio processing and recognitionTranscription/TranscriptSearch.swift– Indexed search across generated captions
Data Models (Models)
The Models module defines the immutable and observable data structures that describe timelines, clips, media assets, and keyframes. These structures are shared across all other modules.
Essential types:
Models/Timeline.swift– Container for tracks and clipsModels/MediaAsset.swift– Metadata wrapper for imported filesModels/Keyframe.swift– Animation and property interpolation data
Supporting Infrastructure
UI and Design System
The UI module provides reusable SwiftUI primitives and the centralized AppTheme. Files like UI/AppTheme.swift and UI/SidebarRowButton.swift ensure visual consistency across the application.
Utilities
The Utilities module contains cross-cutting helpers for logging (Utilities/Log.swift), disk caching (Utilities/DiskCache.swift), image encoding (Utilities/ImageEncoder.swift), and keychain storage.
Help and Inspector
The Help & Inspector modules provide in-app documentation via Help/HelpView.swift and property inspection panels like Inspector/TextTab.swift for editing clip properties.
Toolbar
The Toolbar module centralizes action controls for undo/redo, export triggers, and playback transport through Toolbar/ToolbarView.swift.
Cross-Module Interaction Patterns
The components communicate through the EditorViewModel as a central hub. When a user imports media via the MediaPanel, the asset flows into Models, triggers a Preview update via observable bindings, and becomes available for Generation operations.
The @Observable macro (or ObservableObject in older patterns) ensures that changes to Timeline or MediaAsset instances automatically invalidate SwiftUI views in the Editor and Preview modules, maintaining frame-accurate synchronization without manual observer management.
Summary
- App (
Sources/PalmierPro/App) – Entry point and global state coordination viaAppState.swift - Editor (
Sources/PalmierPro/Editor) – Window management and view-models for the canvas - MediaPanel (
Sources/PalmierPro/MediaPanel) – Asset import and caption management - Preview (
Sources/PalmierPro/Preview) – Real-time rendering viaTimelineRenderer.swiftandVideoEngine.swift - Generation (
Sources/PalmierPro/Generation) – Background video processing and compression - Export (
Sources/PalmierPro/Export) – Format conversion throughXMLExporter.swiftandExportService.swift - Transcription (
Sources/PalmierPro/Transcription) – Speech-to-text with search capabilities - Models (
Sources/PalmierPro/Models) – Core data structures (Timeline.swift,MediaAsset.swift) - UI/Utilities – Design system primitives and helper functions
Frequently Asked Questions
What programming language is Palmier Pro written in?
Palmier Pro is written entirely in Swift, utilizing a hybrid architecture that combines SwiftUI for interface components with AppKit for window management and low-level video rendering. The project requires macOS development tools and follows modern Swift concurrency patterns with async/await for heavy operations like video generation.
How does Palmier Pro handle video preview performance?
The Preview module decouples the UI from rendering using VideoEngine.swift for frame decoding and TimelineRenderer.swift for compositing. According to the source code, the renderer iterates over Timeline.clips in a dedicated rendering context, allowing the main thread to remain responsive while background queues handle pixel buffer operations.
Where is the project data stored in Palmier Pro?
Project data structures are defined in the Models module, specifically in Models/Timeline.swift, Models/MediaAsset.swift, and Models/Keyframe.swift. These in-memory models are serialized to disk via the Export module's PalmierProjectExporter.swift for native format saves, or XMLExporter.swift for interchange with professional editing software like Final Cut Pro.
Can I extend Palmier Pro with custom export formats?
Yes. The Export module uses a service-oriented architecture where ExportService.swift acts as the coordinator. To add a new format, implement a new exporter class following the pattern of XMLExporter.swift (which takes a VideoProject in its initializer and implements a write(to:) method), then register it within ExportService.swift to expose the option in the export UI.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →