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.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

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