# hhk1/prynttrimmerview architecture

> Architecture diagram of the GitHub repository hhk1/prynttrimmerview, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hhk1/prynttrimmerview
- Repository: https://github.com/hhk1/prynttrimmerview

## Overview

PryntTrimmerView is a Swift iOS UI library for selecting video trim ranges and crop frames; it does not perform the final asset export. The example flow loads a video from Photos, then demonstrates trimming with an AVPlayer preview or choosing a crop frame and exporting separately. Core implementation excerpts show the trimmer and crop-view internals; README documents their public workflows. The example’s crop/selection implementation is only partly sampled, so undocumented internal links are omitted.

Main entry points: [`PryntTrimmerViewExample/VideoCropperViewController.swift`](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoCropperViewController.swift) (Crop example), [`PryntTrimmerViewExample/VideoTrimmerViewController.swift`](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoTrimmerViewController.swift) (Trim example), [`PryntTrimmerViewExample/AssetSelectionViewController.swift`](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/AssetSelectionViewController.swift) (Asset selection), [`Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift`](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift) (Trim range UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_trim["Trim UI"]
  node_trimmer["Trim range UI"]
  node_trim_handles["Trim handles<br/>[HandlerView.swift]"]
  node_time_selector["Time mapping"]
  node_filmstrip["Thumbnail filmstrip"]
  node_thumb_selector["Thumbnail selector"]
end

subgraph group_crop["Crop UI"]
  node_crop_view["Crop selection UI"]
  node_crop_mask["Crop mask<br/>[CropMaskView.swift]"]
  node_crop_player["Crop video preview"]
end

subgraph group_example["Example app"]
  node_trim_demo["Trim example"]
  node_crop_demo["Crop example"]
  node_video_export["Example export"]
end

subgraph group_media["Media selection and preview"]
  node_asset_selection["Asset selection"]
  node_av_player["AVPlayer preview"]
end

node_user(("App user"))
node_photo_library[("Photos library")]
node_saved_photos[("Saved videos")]

node_user -->|"chooses video"| node_asset_selection
node_asset_selection -->|"fetches assets"| node_photo_library
node_asset_selection -.->|"loads asset"| node_trim_demo
node_asset_selection -.->|"loads asset"| node_crop_demo
node_trim_demo -->|"sets asset"| node_trimmer
node_trimmer -->|"uses handles"| node_trim_handles
node_trimmer -->|"inherits time mapping"| node_time_selector
node_time_selector -->|"renders thumbnails"| node_filmstrip
node_trim_demo -->|"previews asset"| node_av_player
node_trim_demo -->|"seeks range"| node_trimmer
node_crop_demo -->|"sets asset"| node_crop_view
node_crop_demo -->|"sets asset"| node_thumb_selector
node_crop_view -->|"configures mask"| node_crop_mask
node_crop_view -->|"configures preview"| node_crop_player
node_crop_demo -->|"exports composition"| node_video_export
node_video_export -->|"saves video"| node_saved_photos
node_thumb_selector -->|"reports selected time"| node_crop_demo

click node_asset_selection "https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/AssetSelectionViewController.swift"
click node_trim_demo "https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoTrimmerViewController.swift"
click node_crop_demo "https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoCropperViewController.swift"
click node_trimmer "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift"
click node_trim_handles "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Trimmer/HandlerView.swift"
click node_time_selector "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Parents/AVAssetTimeSelector.swift"
click node_filmstrip "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Parents/AssetVideoScrollView.swift"
click node_thumb_selector "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/ThumbSelectorView.swift"
click node_crop_view "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/VideoCropView.swift"
click node_crop_mask "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/CropMaskView.swift"
click node_crop_player "https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/VideoScrollView.swift"
click node_video_export "https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoCropperViewController.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_trimmer,node_trim_handles,node_time_selector,node_filmstrip,node_thumb_selector,node_user toneBlue
class node_crop_view,node_crop_mask,node_crop_player,node_photo_library,node_saved_photos toneAmber
class node_trim_demo,node_crop_demo,node_video_export toneMint
class node_asset_selection,node_av_player toneRose
```

## Components

### Trim UI

- [Trim range UI](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift): `Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift`
- [Trim handles](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Trimmer/HandlerView.swift): `Sources/PryntTrimmerView/Trimmer/HandlerView.swift`
- [Time mapping](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Parents/AVAssetTimeSelector.swift): `Sources/PryntTrimmerView/Parents/AVAssetTimeSelector.swift`
- [Thumbnail filmstrip](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Parents/AssetVideoScrollView.swift): `Sources/PryntTrimmerView/Parents/AssetVideoScrollView.swift`
- [Thumbnail selector](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/ThumbSelectorView.swift): `Sources/PryntTrimmerView/ThumbSelectorView.swift`

### Crop UI

- [Crop selection UI](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/VideoCropView.swift): `Sources/PryntTrimmerView/Cropper/VideoCropView.swift`
- [Crop mask](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/CropMaskView.swift): `Sources/PryntTrimmerView/Cropper/CropMaskView.swift`
- [Crop video preview](https://github.com/hhk1/prynttrimmerview/blob/master/Sources/PryntTrimmerView/Cropper/VideoScrollView.swift): `Sources/PryntTrimmerView/Cropper/VideoScrollView.swift`

### Example app

- [Trim example](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoTrimmerViewController.swift): `PryntTrimmerViewExample/VideoTrimmerViewController.swift`
- [Crop example](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoCropperViewController.swift): `PryntTrimmerViewExample/VideoCropperViewController.swift`
- [Example export](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/VideoCropperViewController.swift): `PryntTrimmerViewExample/VideoCropperViewController.swift`

### Media selection and preview

- [Asset selection](https://github.com/hhk1/prynttrimmerview/blob/master/PryntTrimmerViewExample/AssetSelectionViewController.swift): `PryntTrimmerViewExample/AssetSelectionViewController.swift`
- **AVPlayer preview**

### Other components

- **App user**
- **Photos library**
- **Saved videos**

## Connections

- App user → Asset selection: chooses video (evidence: `PryntTrimmerViewExample/AssetSelectionViewController.swift`)
- Asset selection → Photos library: fetches assets (evidence: `PryntTrimmerViewExample/AssetSelectionViewController.swift`)
- Asset selection → Trim example: loads asset (evidence: `PryntTrimmerViewExample/VideoTrimmerViewController.swift`)
- Asset selection → Crop example: loads asset (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
- Trim example → Trim range UI: sets asset (evidence: `PryntTrimmerViewExample/VideoTrimmerViewController.swift`)
- Trim range UI → Trim handles: uses handles (evidence: `Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift`)
- Trim range UI → Time mapping: inherits time mapping (evidence: `Sources/PryntTrimmerView/Trimmer/PryntTrimmerView.swift`)
- Time mapping → Thumbnail filmstrip: renders thumbnails (evidence: `Sources/PryntTrimmerView/Parents/AVAssetTimeSelector.swift`)
- Trim example → AVPlayer preview: previews asset (evidence: `PryntTrimmerViewExample/VideoTrimmerViewController.swift`)
- Trim example → Trim range UI: seeks range (evidence: `PryntTrimmerViewExample/VideoTrimmerViewController.swift`)
- Crop example → Crop selection UI: sets asset (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
- Crop example → Thumbnail selector: sets asset (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
- Crop selection UI → Crop mask: configures mask (evidence: `Sources/PryntTrimmerView/Cropper/VideoCropView.swift`)
- Crop selection UI → Crop video preview: configures preview (evidence: `Sources/PryntTrimmerView/Cropper/VideoCropView.swift`)
- Crop example → Example export: exports composition (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
- Example export → Saved videos: saves video (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
- Thumbnail selector → Crop example: reports selected time (evidence: `PryntTrimmerViewExample/VideoCropperViewController.swift`)
