Swiftpack.co - duzexu/ADPhotoKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by duzexu.
duzexu/ADPhotoKit 1.1.1
A library for select photos from album implemented by pure-Swift.
⭐️ 2
🕓 2 weeks ago
iOS
.package(url: "https://github.com/duzexu/ADPhotoKit.git", from: "1.1.1")

logo

Version License Platform Language

ADPhotoKit is a pure-Swift library to select assets (e.g. photo,video,gif,livephoto) from system album. Default appearance is Wechat-like.

Features

  • 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.

Usage

Quick Start

The simplest use-case is present the image picker on your controller:

ADPhotoKitUI.imagePicker(present: self) { (assets, origin) in
    // do something
}

More Advanced Example

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.

Learn More

To lean more use of ADPhotoKit, refer to the example and API Reference.

Requirements

  • 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 :)

Installation

CocoaPods

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+

Subspecs

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.

Swift Package Manager

Note

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

Contributing

If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues.

License

ADPhotoKit is available under the MIT license. See the LICENSE file for more info.

Some code and resource are copy from ZLPhotoBrowser

GitHub

link
Stars: 2
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics