LightPaint 1.0 overview
Technical in LightPaint 1.0

LightPaint 1.0 guide

Technical

Technical, from the LightPaint version 1.0 guide library.

Core Technologies

Frameworks & Libraries

UI Framework

SwiftUI + UIKit Hybrid

Modern declarative UI with complex camera integration

GPU Acceleration

Metal GPU Framework

Real-time light painting effects and rendering

Camera & Video

AVFoundation

Professional camera capture and video processing

Data Storage

Core Data

Local persistence with migration support

Image Processing

Core Image

Advanced image processing pipeline

Voice Control

AppIntents

Siri integration for voice control

Platform Requirements

  • iOS Target: 16.6+
  • Xcode Version: 16.2+
  • Swift Version: 5.0

<!-- -->

  • Device Support: iPhone only
  • Bundle ID: com.shutterspeedapps.lightpainted
  • Analytics: Firebase integration

Architecture Patterns

MVVM (Model-View-ViewModel)

Primary design pattern for clean separation of concerns:

Architecture Benefits

  • Observable view models manage business logic
  • Reactive UI updates through @Published
  • Clear separation of concerns
  • Testable business logic

Key ViewModels

  • `EasyViewModel` - Main app state
  • `TimelapseCameraViewModel` - Camera session
  • `TimelapseListViewModel` - Media organization
  • `SharedObjectsController` - Resources

Singleton Pattern

Core singletons for shared resources:

`CoreDataManager.shared`

Database persistence

`SharedMetalCIContext.shared`

GPU rendering context

`OrientationManager.shared`

Device orientation

`TaskManager.shared`

Background processing

Metal Rendering Pipeline

GPU Processing Flow

Camera Input → Metal Texture Cache → Frame Blending Engine → Light Trail Composition → Display/Export

MetalRendererContext

Device and pipeline management

SharedMetalCIContext

Optimized Core Image context

FrameBlendingEngine

Real-time light trail blending

Blending Modes Implementation

``` text-gray-300 enum BlendMode: String, CaseIterable { case additive = "additiveBlendFragment" case screen = "screenBlendFragment" case lighten = "lightenBlendFragment" case starTrail = "starTrailBlendFragment" case steelWool = "steelWoolBlendFragment" } ```

Data Persistence

Core Data Architecture

Features

  • Dynamic container creation
  • Fresh install vs. migration support
  • Seeded data (pre-populated profiles)
  • Seamless TimeLapsed Pro transition

Thread Safety

  • Background context management
  • Main thread UI updates
  • Concurrent queue operations
  • Automatic save coordination

Modern Settings (@AppStorage)

``` text-gray-300 @MainActor class AppSettings: ObservableObject { @AppStorage("selectedTheme") var selectedTheme: String = "dark" @AppStorage("enableMetalAcceleration") var enableMetalAcceleration: Bool = true @AppStorage("lightThreshold") var lightThreshold: Float = 0.5 @AppStorage("trailFadeAmount") var trailFadeAmount: Float = 0.002 } ```

Background Processing

TaskManager System

``` text-gray-300 class TaskManager { private let maxConcurrentTasks: Int = 8 private let semaphore: DispatchSemaphore private let queue: DispatchQueue // .utility QoS } ```

Task Types

  • `timelapseRender` - Video composition
  • `imageStackRender` - Light trail processing
  • `importFiles` - Media import operations
  • `createOptimizedFiles` - Asset optimization

Features

  • Concurrent task limiting
  • Progress tracking
  • Cancellation support
  • Memory pressure handling

Memory Management

Resource Cleanup

  • Automatic camera resource management
  • Image cache with memory pressure handling
  • Proper Metal texture lifecycle
  • Weak references prevent retain cycles

Performance Optimizations

  • Lazy loading for on-demand resources
  • Cache eviction on memory pressure
  • Non-blocking background operations
  • Metal command queue optimization

Device Orientation & Build Configuration

Dynamic Orientation System

``` text-gray-300 class OrientationManager: ObservableObject { @Published var isPortraitUpsideDown: Bool = false @Published var rotationAngle: Double = 0.0 private var isOrientationLocked: Bool } ```

  • Orientation locking for stable capture
  • Smooth animated transitions (0.3s)

<!-- -->

  • User-configurable preferences
  • Camera session coordination

Build Configuration

Development Settings

  • Optimization: `-Onone` for debugging
  • Metal Debugging: Source-level enabled
  • Memory Tools: Full debug symbols
  • Assertion behavior: Enabled

Release Optimization

  • Whole Module Optimization
  • Metal Performance: Fast math
  • Code Signing: Automatic
  • dSYM Generation: Crash symbolication

Related documentation

More LightPaint 1.0 pages