DKImagePickerController
Image Picker Controller for iOS written in Swift 3.2 & 4.
Description
DKImagePickerController
is a highly customizable, Pure-Swift library.
Features
- Supports both single and multiple selection.
- Supports filtering albums and sorting by type.
- Supports landscape, iPad, and orientation switching.
- iCloud Support.
- Supports batch exports
PHAsset
to lcoal files. - Inline mode Support.
- Customizable
UICollectionViewLayout
. - Customizable
camera
,photo gallery
andphoto editor
. - Dark Mode Support
Requirements
- iOS 8.0+
- ARC
- Swift 4 & 5
Installation
CocoaPods
iOS 8 and newer
DKImagePickerController is available on CocoaPods. Simply add the following line to your podfile:
# For latest release in cocoapods
pod 'DKImagePickerController'
For Swift 4.1
pod 'DKImagePickerController', :git => 'https://github.com/zhangao0086/DKImagePickerController.git', :branch => 'Swift4'
Subspecs
There are 7 subspecs available now:
Subspec | Description |
---|---|
Core | Required. |
ImageDataManager | Required. The subspec provides data to DKImagePickerController . |
Resource | Required. The subspec provides resource management and internationalization. |
PhotoGallery | Optional. The subspec provides preview feature for PHAsset. |
Camera | Optional. The subspec provides camera feature. |
InlineCamera | Optional. The subspec should be pushed by UINavigationController , like UIImagePickerController with UIImagePickerControllerSourceType.camera . |
PhotoEditor | Optional. The subspec provides basic image editing features. |
This means you can install only some of the DKImagePickerController
modules. By default, you get all subspecs.
If you need to use your own photo editor, simply specify subspecs other than PhotoEditor
:
Carthage
github "zhangao0086/DKImagePickerController"
If you use Carthage to build your dependencies, make sure you have added CropViewController.framework
, DKCamera.framework
, DKImagePickerController.framework
, DKPhotoGallery.framework
and SDWebImage.framework
to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.
Getting Started
Initialization and presentation
Inline Mode

Customizable UI

For example, see CustomUIDelegate.
Customizable Layout

For example, see CustomLayoutUIDelegate.
Conforms UIAppearance protocol

You can easily customize the appearance of the navigation bar using the appearance proxy.
Exporting to file
By default, the picker uses a singleton object of DKImageAssetExporter
to export DKAsset
to local files.
This exporter can automatically convert HEIF to JPEG:
You also can observe the export progress of each asset:
For example, see Export automatically
and Export manually
.
Extensions
This picker uses DKImageExtensionController
manages all extensions, you can register it with a DKImageBaseExtension
and a specified DKImageExtensionType
to customize camera
, photo gallery
and photo editor
:
The perform
function will be called with a dictionary providing current context information when an extension is triggered:
The extraInfo
will provide different information for different DKImageExtensionType
:
Camera
For a custom camera example, see CustomCameraExtension.
InlineCamera
The extraInfo
is the same as for Camera
.
Photo Gallery
Photo Editor
How to use in Objective-C
If you use CocoaPods
-
Add the following two lines into your
Podfile
:pod 'DKImagePickerController' use_frameworks!
-
Import the library into your Objective-C file:
If you use it directly in your project
-
Drag and drop the [DKCamera][DKCamera],
DKImageManager
andDKImagePickerController
to your project -
Import the library into your Objective-C file:
then you can:
Localization
The default supported languages:
en, es, da, de, fr, hu, ja, ko, nb-NO, pt_BR, ru, tr, ur, vi, ar, it, zh-Hans, zh-Hant
You can also add a hook to return your own localized string:
or images: