MVImagePicker

MVImagePicker allows you to inject the photo library to your app


License
MIT
Install
pod try MVImagePicker

Documentation

MVImagePicker

CI Status Version License Platform

1 2

Features

  • Multiple selection
  • Switching between albums
  • Taking photos

Usage

You can do the next steps to use MVImagePicker:

let ctrl = ImagePickerViewController()

ctrl.delegate = self
ctrl.multipleSelection = false
ctrl.scrollDelegate = self

self.view.addSubview(ctrl.view)
self.addChildViewController(ctrl)

MVImagePicker has several delegate methods:

1. ImagePickerViewControllerDelegate protocol

optional func imagePickerViewControllerDidEnabled(viewController: ImagePickerViewController, isAuthorized: Bool)

This delegate is used when user permits access to the photos on the device

optional func imagePickerViewControllerLibraryDidSelect(viewController: ImagePickerViewController)

This delegate is used when user clicks on the library icon in the top of the MVImagePicker controller

optional func imagePickerViewControllerAlbumOpened(viewController: ImagePickerViewController, album: PHAssetCollection)

This delegate method is used when user opens a library

optional func imagePickerViewControllerBeforeAssetChanged(viewController: ImagePickerViewController)
optional func imagePickerViewControllerAfterAssetChanged(viewController: ImagePickerViewController)

These 2 delegate methods are used before and after user adds a new asset into the library

func imagePickerViewControllerAssetDidCreate(viewController: ImagePickerViewController, asset: PHAsset, locally: Bool)
func imagePickerViewControllerAssetDidRemove(viewController: ImagePickerViewController, asset: PHAsset)

These 2 delegate methods are used when an asset is created or removed from the library (even using Photos or some another app)

func imagePickerViewControllerAssetDidSelect(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)
func imagePickerViewControllerAssetDidDeselect(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)

These 2 delegate methods are used when user selects or deselects an asset in the library

optional func imagePickerViewControllerAssetDidLongTap(viewController: ImagePickerViewController, asset: PHAsset, cell: ImagePickerPhotoCell)

This delegate method is used when user does a long tap on any asset in the library

2. ImagePickerViewControllerScrollDelegate protocol

optional func imagePickerViewControllerWillBeginDragging(scrollView: UIScrollView)
optional func imagePickerViewControllerDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool)
optional func imagePickerViewControllerDidScroll(scrollView: UIScrollView)

These 3 delegates are just wrappers for standard scrollViewWillBeginDragging, scrollViewDidEndDragging and scrollViewDidScroll, and they are used for photos collection view

Requirements

iOS 8 or above

Installation

MVImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MVImagePicker"

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Mikhail Vetoshkin, mvetoshkin@gmail.com

License

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