media/DSImagePicker
DSImagePicker
mediaPhoto 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
| Prop | Type | Default | Description |
|---|---|---|---|
| imagereq | Binding<UIImage?> | โ | Bound selected image. |
| allowsCamera | Bool | true | Includes camera as a source option. |
| cropStyle | DSCropStyle | .square | .square, .circle, .freeform. |
| placeholder | String | "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: {})
}
}