DKImagePickerController Overview
DKImagePickerController is a robust, highly configurable, open-source Image Picker Controller for iOS written in Swift. It is designed to replace UIImagePickerController, bringing enhanced capabilities such as Camera roll customization, UI theming, and asset selection across different albums.
Main Features
- Multi-selection.
- UI Customization.
- Camera roll customization with the exclusion or inclusion of custom source types.
- Full-screen image viewer with gestures support.
- Flexible filtering option for selecting specific types of assets like videos or pictures.
- Supports fetching photos, live photos, and videos.
- Internationalization support.
Installation
CocoaPods
If you use CocoaPods to manage your dependencies, you can use it to install DKImagePickerController’s binary and/or code modules. Add the following line to your Podfile:
pod 'DKImagePickerController'
Swift Package Manager
The Swift Package Manager is a tool for managing the distribution of Swift code and is integrated with the swift compiler. DKImagePickerController offers support for it.
Usage
Below snippet shows the basic usage of DKImagePickerController:
let pickerController = DKImagePickerController()
pickerController.didSelectAssets = { (assets: [DKAsset]) in
print("didSelectAssets")
print(assets)
}
pickerController.present()
Configuration
DKImagePickerController can be customizable to your need. To set which albums to show, use:
DKImagePickercontrollerAssetType.onlyPhotos
For customization of UI Elements refer to:
DKImagePickerControllerUIDelegate
Localization
DKImagePickerController supports multiple languages. Localize it according to your needs with the DKImagePickerResourceCustomization protocol.