# shu223/ios-depth-sampler architecture

> Architecture diagram of the GitHub repository shu223/ios-depth-sampler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shu223/ios-depth-sampler
- Repository: https://github.com/shu223/ios-depth-sampler

## Overview

iOS-Depth-Sampler is an iPhone depth-API example app. Users select a sample from the catalog, which instantiates the corresponding storyboard controller; the samples demonstrate live camera depth, depth-derived masks, still-image depth and portrait mattes, ARKit depth, and image rendering in 3D. The sampled capture and image-source utilities show internal acquisition and depth decoding layers. Individual sample implementations were not excerpted, so their internal calls and rendering paths are not asserted.

Main entry points: [`iOS-Depth-Sampler/RootViewController.swift`](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/RootViewController.swift) (Sample navigation), [`iOS-Depth-Sampler/DepthImagePickableViewController.swift`](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/DepthImagePickableViewController.swift) (Depth photo picker), [`iOS-Depth-Sampler/VideoCapture/VideoCapture.swift`](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/VideoCapture/VideoCapture.swift) (Video capture), [`iOS-Depth-Sampler/SampleDataSource.swift`](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/SampleDataSource.swift) (Sample catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Sample Catalog"]
  node_root["Sample navigation"]
  node_source["Sample catalog"]
  node_cell["Catalog cell<br/>[RootViewCell.swift]"]
end

subgraph group_camera["Camera Capture"]
  node_capture["Video capture<br/>[VideoCapture.swift]"]
  node_device["Depth formats"]
end

subgraph group_depth["Depth Samples"]
  node_realtime["Live depth"]
  node_mask["Live depth mask"]
  node_camera_roll["Camera roll depth"]
  node_picker["Depth photo picker"]
  node_image_depth["Image depth decoding"]
  node_matte["Portrait matte"]
  node_arkit["ARKit depth"]
end

subgraph group_render["Rendering"]
  node_pointcloud["Image in 3D"]
  node_metal["Metal renderer"]
end

node_user(("App user"))

node_user -->|"selects sample"| node_root
node_root -->|"reads catalog"| node_source
node_root -->|"displays sample"| node_cell
node_root -->|"opens storyboard"| node_realtime
node_root -->|"opens storyboard"| node_mask
node_root -->|"opens storyboard"| node_camera_roll
node_root -->|"opens storyboard"| node_matte
node_root -->|"opens storyboard"| node_arkit
node_root -->|"opens storyboard"| node_pointcloud
node_capture -->|"selects depth format"| node_device
node_picker -.->|"loads selected image"| node_image_depth
node_user -->|"chooses depth photo"| node_picker

click node_root "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/RootViewController.swift"
click node_source "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/SampleDataSource.swift"
click node_cell "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/RootViewCell.swift"
click node_capture "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/VideoCapture/VideoCapture.swift"
click node_device "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/VideoCapture/AVCaptureDevice%2BExtension.swift"
click node_realtime "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Realtime-Depth"
click node_mask "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Realtime-Mask"
click node_camera_roll "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Depth-from-Camera-Roll"
click node_picker "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/DepthImagePickableViewController.swift"
click node_image_depth "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/Utils/CGImageSource%2BDepth.swift"
click node_matte "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Portrait-Matte"
click node_arkit "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/ARKit"
click node_pointcloud "https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/PointCloud"
click node_metal "https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/Renderer/MetalRenderer.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_root,node_source,node_cell,node_user toneBlue
class node_capture,node_device toneAmber
class node_realtime,node_mask,node_camera_roll,node_picker,node_image_depth,node_matte,node_arkit toneMint
class node_pointcloud,node_metal toneRose
```

## Components

### Sample Catalog

- [Sample navigation](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/RootViewController.swift): `iOS-Depth-Sampler/RootViewController.swift`
- [Sample catalog](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/SampleDataSource.swift): `iOS-Depth-Sampler/SampleDataSource.swift`
- [Catalog cell](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/RootViewCell.swift): `iOS-Depth-Sampler/RootViewCell.swift`

### Camera Capture

- [Video capture](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/VideoCapture/VideoCapture.swift): `iOS-Depth-Sampler/VideoCapture/VideoCapture.swift`
- [Depth formats](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/VideoCapture/AVCaptureDevice%2BExtension.swift): `iOS-Depth-Sampler/VideoCapture/AVCaptureDevice+Extension.swift`

### Depth Samples

- [Live depth](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Realtime-Depth): `iOS-Depth-Sampler/Samples/Realtime-Depth`
- [Live depth mask](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Realtime-Mask): `iOS-Depth-Sampler/Samples/Realtime-Mask`
- [Camera roll depth](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Depth-from-Camera-Roll): `iOS-Depth-Sampler/Samples/Depth-from-Camera-Roll`
- [Depth photo picker](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/DepthImagePickableViewController.swift): `iOS-Depth-Sampler/DepthImagePickableViewController.swift`
- [Image depth decoding](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/Utils/CGImageSource%2BDepth.swift): `iOS-Depth-Sampler/Utils/CGImageSource+Depth.swift`
- [Portrait matte](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/Portrait-Matte): `iOS-Depth-Sampler/Samples/Portrait-Matte`
- [ARKit depth](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/ARKit): `iOS-Depth-Sampler/Samples/ARKit`

### Rendering

- [Image in 3D](https://github.com/shu223/ios-depth-sampler/tree/master/iOS-Depth-Sampler/Samples/PointCloud): `iOS-Depth-Sampler/Samples/PointCloud`
- [Metal renderer](https://github.com/shu223/ios-depth-sampler/blob/master/iOS-Depth-Sampler/Renderer/MetalRenderer.swift): `iOS-Depth-Sampler/Renderer/MetalRenderer.swift`

### Other components

- **App user**

## Connections

- App user → Sample navigation: selects sample (evidence: `README.md`)
- Sample navigation → Sample catalog: reads catalog (evidence: `iOS-Depth-Sampler/RootViewController.swift`)
- Sample navigation → Catalog cell: displays sample (evidence: `iOS-Depth-Sampler/RootViewController.swift`)
- Sample navigation → Live depth: opens storyboard
- Sample navigation → Live depth mask: opens storyboard
- Sample navigation → Camera roll depth: opens storyboard
- Sample navigation → Portrait matte: opens storyboard
- Sample navigation → ARKit depth: opens storyboard
- Sample navigation → Image in 3D: opens storyboard
- Video capture → Depth formats: selects depth format (evidence: `iOS-Depth-Sampler/VideoCapture/VideoCapture.swift`)
- Depth photo picker → Image depth decoding: loads selected image
- App user → Depth photo picker: chooses depth photo (evidence: `iOS-Depth-Sampler/DepthImagePickableViewController.swift`)
