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.

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