ADPhotoKit is a pure-Swift library to select assets (e.g. photo,video,gif,livephoto) from system album. Default appearance is Wechat-like.
- Well documentation.
- Supports both single and multiple selection.
- Supports filtering albums and sorting by type.
- iCloud Support.
- Multi-language.
- Highly customizable base on protocol(UI/Image/Color/Font).
- UIAppearance support.
- Supports batch export PHAsset to image.
- Image editor.
- DocC support.
- Custom camera.
- Video editor.
The simplest use-case is present the image picker on your controller:
ADPhotoKitUI.imagePicker(present: self) { (assets, origin) in
// do something
}
Select up to 9 images or videos:
ADPhotoKitUI.imagePicker(present: self,
params: [.maxCount(max: 9)],
selected: { (assets, origin) in
// do something
})
Select 1 video or 9 images:
ADPhotoKitUI.imagePicker(present: self,
assetOpts: .exclusive,
params: [.maxCount(max: 9),.imageCount(min: nil, max: 9),.videoCount(min: nil, max: 1)],
selected: { (assets, origin) in
// do something
})
Select max 8 images:
ADPhotoKitUI.imagePicker(present: self,
albumOpts: [.allowImage],
assetOpts: .exclusive,
params: [.maxCount(max: 8)],
selected: { (assets, origin) in
// do something
})
Browser network image and video:
ADPhotoKitUI.assetBrowser(present: self,
assets: [NetImage(url: "https://example.com/xx.png"), NetVideo(url: "https://example.com/xx.mp4")]) { assets in
// do something
}
For more usage configuration, you can see ADPhotoKitUI.
To lean more use of ADPhotoKit, refer to the example and API Reference.
- iOS 10.0
- Swift 5.0+
Objective-C is not supported. Swift is the future and dropping Obj-C is the price to pay to keep our velocity on this library :)
ADPhotoKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
source 'https://cdn.cocoapods.org/'
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'ADPhotoKit'
end
DocC support need cocoaPods 1.12.0+
There are 4 subspecs available now:
Subspec | Description |
---|---|
Base | Required. This subspec provides base configuration and extensions. |
Core | Optional. This subspec provides raw data. |
CoreUI | Optional. The subspec provides ui for photo select. |
ImageEdit | Optional. The subspec provides image edit ability. |
You can install only some of the ADPhotoKit modules. By default, you get CoreUI
subspecs.
- File > Swift Packages > Add Package Dependency
- Add https://github.com/duzexu/ADPhotoKit.git
- Select "Branch" with "master"
You need to add the following key-value pairs in your app's Info.plist
// If you don’t add this key-value pair, multiple languages are not supported, and the system PhotoKitUI language defaults to English
Localized resources can be mixed YES
// You must add follow in your app's Info.plist
Privacy - Photo Library Usage Description
// If you `assetOpts` contain `allowTakePhotoAsset`, you must add follow
Privacy - Camera Usage Description
// If you `assetOpts` contain `allowTakeVideoAsset`, you must add follow
Privacy - Microphone Usage Description
If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues.
ADPhotoKit is available under the MIT license. See the LICENSE file for more info.
Some code and resource are copy from ZLPhotoBrowser