Main Modules and Components of Palmier Pro: A Complete Architecture Guide
Palmier Pro organizes its Swift codebase into twelve distinct functional modules—App, Editor, MediaPanel, Preview, Generation, Export, Transcription, Models, UI, Utilities, Help & Inspector, and Toolbar—that form a layered architecture spanning application lifecycle management, video editing interfaces, real-time preview rendering, and multi-format export capabilities.
Palmier Pro is a macOS video editing application built with Swift and distributed as a set of Swift packages under the palmier-io/palmier-pro repository. The source code in Sources/PalmierPro implements a modular architecture that separates concerns into distinct domains, using a hybrid SwiftUI and AppKit approach with @Observable view-models to synchronize the interface with underlying video project data.
Core Application Layer: The App Module
The App module serves as the entry point for the Palmier Pro application lifecycle, handling menu management, global state coordination, and software update mechanisms. Located in Sources/PalmierPro/App/, this module contains main.swift as the application entry point, AppState.swift which orchestrates project loading, and Updater.swift which manages version updates.
Lifecycle and State Management
The AppState class manages the asynchronous opening of video projects through the openProject(at:register:) method. When a user selects a project file, the application transitions control to the Editor module via the EditorViewModel.
// Sources/PalmierPro/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: The Editor Module
The Editor module provides the primary window controller and view hierarchy for the main editing canvas. This module, found in Sources/PalmierPro/Editor/, bridges the data models with the user interface through dedicated view-models.
Window Management and View Hierarchy
EditorWindowController.swift manages the document window lifecycle, while EditorView.swift defines the SwiftUI interface. The module uses ViewModel/EditorViewModel.swift to maintain project state and coordinate with other modules.
View-Model Integration
When opening a project, the EditorViewModel receives launch options through the apply(_:to:) method, enabling behaviors like automatic tutorial initiation:
// Sources/PalmierPro/Editor/ViewModel/EditorViewModel.swift
func apply(_ options: ProjectOpenOptions, to editor: EditorViewModel) {
if options.startTutorial {
DispatchQueue.main.async { editor.tour.start(in: editor) }
}
}
Media and Preview Systems
MediaPanel Module: Asset Management
The MediaPanel module handles browsing, import, and management of media assets including videos, images, audio, and Lottie files. Key files include MediaPanelView.swift and MediaTab/MediaTab.swift, which provide the interface for asset organization, and CaptionsTab/CaptionTab.swift for subtitle management.
Assets are added to the project through the MediaAsset model defined in the Models module:
// Sources/PalmierPro/MediaPanel/MediaTab/AssetThumbnailView.swift
func addAsset(_ asset: MediaAsset) {
project.editorViewModel.mediaAssets.append(asset)
}
Preview Module: Real-Time Rendering
The Preview module manages real-time video preview, timeline rendering, and overlay controls. Located in Sources/PalmierPro/Preview/, it contains PreviewView.swift for the interface, TimelineRenderer.swift for drawing operations, and VideoEngine.swift for playback control.
The TimelineRenderer processes the Timeline model to draw frame sequences:
// Sources/PalmierPro/Preview/TimelineRenderer.swift
func renderTimeline(_ timeline: Timeline, in context: RenderingContext) {
// Iterate over clips and draw each frame.
timeline.clips.forEach { clip in
// …
}
}
Processing and Export Pipeline
Generation Module: Video Rendering and Compression
The Generation module handles video rendering, compression, and editing-specific extraction tasks like trimming. GenerationService.swift coordinates the pipeline, while VideoCompressor.swift and Edit/VideoTrimExtractor.swift perform specialized operations on media assets.
Export Module: Format Conversion
The Export module converts Palmier projects into various formats including XML, Lottie, and text-based exports. ExportService.swift provides the main entry point, utilizing specialized exporters like XMLExporter.swift and PalmierProjectExporter.swift.
// Sources/PalmierPro/Export/ExportService.swift
func exportProject(_ project: VideoProject, to url: URL) throws {
let exporter = XMLExporter(project: project)
try exporter.write(to: url)
}
Supporting Infrastructure
Data Models (Models Module)
The Models module defines core data structures for timelines, clips, media assets, and keyframes. Key files include Timeline.swift, MediaAsset.swift, and Keyframe.swift, which serve as the single source of truth for project state across all modules.
Transcription and Search
The Transcription module provides speech-to-text capabilities for video assets, with Transcription.swift handling the conversion process and TranscriptSearch.swift enabling text-based searching within media content.
UI Design System and Utilities
The UI module contains reusable SwiftUI primitives and the design system centered on AppTheme.swift and SidebarRowButton.swift. The Utilities module provides cross-cutting concerns including logging (Log.swift), disk caching (DiskCache.swift), image encoding (ImageEncoder.swift), and keychain storage.
Help, Inspector, and Toolbar
The Help & Inspector modules deliver in-app documentation through HelpView.swift and property editing through panels like Inspector/TextTab.swift. The Toolbar module centralizes action controls in ToolbarView.swift, managing undo/redo, export triggers, and playback controls.
Summary
- Palmier Pro organizes code into twelve distinct modules under
Sources/PalmierPro, each handling specific functional domains from application lifecycle to final export. - The App module manages the entry point and global state, while the Editor module controls the main window and view-models.
- MediaPanel and Preview handle asset management and real-time timeline rendering using
TimelineRendererandVideoEngine. - Generation and Export form the output pipeline, handling video compression through
VideoCompressorand format conversion viaXMLExporter. - Models provides the shared data layer, supported by Transcription, UI, Utilities, and interface modules for help, inspection, and toolbar actions.
- The architecture follows a layered flow: App → Editor → MediaPanel/Preview → Generation → Export.
Frequently Asked Questions
What programming language is Palmier Pro built with?
Palmier Pro is built using Swift, leveraging a hybrid architecture that combines SwiftUI for interface components with AppKit for macOS-specific window management. The codebase uses modern Swift features including @Observable view-models and structured concurrency with async/await for asynchronous operations like project loading in AppState.swift and media import.
How does Palmier Pro handle communication between modules?
Modules communicate through shared data models and view-model references. For example, the MediaPanel module appends MediaAsset instances to arrays managed by the EditorViewModel, while the Preview module's TimelineRenderer reads from the Timeline model defined in the Models module. This follows an MVVM pattern where view-models in the Editor module coordinate state across functional boundaries.
What file formats can Palmier Pro export?
According to the Export module source code in Sources/PalmierPro/Export/, Palmier Pro supports conversion to XML, Lottie, and text-based formats. The ExportService.swift file coordinates these operations through specialized exporters like XMLExporter.swift and PalmierProjectExporter.swift, enabling interoperability with other video editing and animation tools.
Where is the entry point of the Palmier Pro application?
The application entry point resides in Sources/PalmierPro/App/main.swift within the App module. This file initializes the application lifecycle, sets up the menu bar, and instantiates the AppState class that manages global application state and project window coordination, as implemented in the palmier-io/palmier-pro repository.
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 →