screens/DSMediaGallery
DSMediaGallery
screensResponsive photo/video grid with a full-screen viewer, pinch-to-zoom, and swipe-to-dismiss. Supports lazy loading.
iOS 17+
Purpose
Profile photo grids, product image galleries, and in-app media browsers.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| itemsreq | [DSMediaItem] | โ | Array of image/video URLs with thumbnails. |
| columns | Int | 3 | Grid columns. |
| spacing | CGFloat | 2 | Gap between cells (tight by default). |
| onSelect | ((DSMediaItem) -> Void)? | nil | Called when a cell is tapped. |
| showVideoBadge | Bool | true | Shows a play icon badge on video items. |
Examples
Profile photo grid
Instagram-style 3-column grid.
swift
DSMediaGallery(
items: viewModel.userPosts.map { $0.thumbnailItem },
columns: 3,
spacing: 2
) { item in
navigate(.postDetail(item.id))
}