CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

PhotoPicker 0.1.2

PhotoPicker 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2017
SwiftSwift Version 3.1
SPMSupports SPM

Maintained by Dark Dong.



  • By
  • Dark Dong

A photo picker that select photos from system albums

Requirements

iOS 8.0, Swift 3.1

Installation

Manual

Download and add sources to your project

Usage

Basic Usage

let picker = PhotoPickerNavigationController.nc
present(picker, animated: true, completion: nil)

Config Picker

let picker = PhotoPickerNavigationController.nc
picker.config.rootTitle = "Root Title"
picker.config.mediaType = .image
present(picker, animated: true, completion: nil)

Picker Delegation

class ViewController: UIViewController {
    func showPicker() {        
        let picker = PhotoPickerNavigationController.nc 
        picker.pickerDelegate = self
        present(picker, animated: true, completion: nil)
    }
}

extension ViewController: PhotoPickerDelegate {
    func picker(_ picker: PhotoPickerNavigationController, didSelectAssets assets: [PHAsset]) {
        //do what you want
        //...
        
        //dismiss picker
        picker.dismiss(animated: true, completion: nil)
    }
    
    func picker(_ picker: PhotoPickerNavigationController, shouldSelectAsset: PHAsset, selectedAssets: [PHAsset]) -> Bool {
        //limit number of selections
        if selectedAssets.count >= 2 {
            return false
        }
        return true
    }
}

License

PhotoPicker is released under the MIT license. See LICENSE for details.