media/DSImagePicker

DSImagePicker

media
since v2.0

Photo library and camera source picker that returns a UIImage/SwiftUI Image. Shows a preview thumbnail after selection.

iOS 17+

Purpose

Profile photo upload, post creation, avatar editing.

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
imagereqBinding<UIImage?>โ€”Bound selected image.
allowsCameraBooltrueIncludes camera as a source option.
cropStyleDSCropStyle.square.square, .circle, .freeform.
placeholderString"Add photo"Empty state label.

Examples

Profile avatar editor

Tappable avatar that opens the image picker.

swift
DSImagePicker(image: $profilePhoto, cropStyle: .circle) {
    DSAvatar(image: profilePhoto, size: .xl)
        .overlay(alignment: .bottomTrailing) {
            DSIconButton(icon: "camera.fill", size: .sm, action: {})
        }
}

Related Components