screens/DSMediaGallery

DSMediaGallery

screens
since v2.0

Responsive 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

PropTypeDefaultDescription
itemsreq[DSMediaItem]โ€”Array of image/video URLs with thumbnails.
columnsInt3Grid columns.
spacingCGFloat2Gap between cells (tight by default).
onSelect((DSMediaItem) -> Void)?nilCalled when a cell is tapped.
showVideoBadgeBooltrueShows 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))
}

Related Components