Skip to content

📷A image picker for iOS , written by Swift

License

Notifications You must be signed in to change notification settings

StormXX/PhotoPicker

 
 

Repository files navigation

PhotoPicker

📷A image picker for iOS , written by Swift.(support preview the image)

refer: teambition/PhotoPicker

GIF

image

How To Get Started

Carthage

Specify "PhotoPicker" in your Cartfile:

github "StormXX/PhotoPicker"

DEMO

run carthage update to fetch the PhotoBrowser. Becaust this PhotoPicker support previewing the photo

Usage

configuration properties

//MARK: - public property
open weak var delegate: PhotoPickerDelegate?
open var assetCollectionSubtypes: [PHAssetCollectionSubtype]?
open var allowMultipleSelection: Bool = true
open var minimumNumberOfSelection: Int = 1
open var maximumNumberOfSelection: Int = 9
open var mediaType: PhotoPickerMediaType = .any
open var prompt: String?

Implement delegate

func photoPickerController(controller: PhotoPickerController, didFinishPickingAssets assets: [PHAsset], needHighQualityImage: Bool)
func photoPickerControllerDidCancel(controller: PhotoPickerController)
func photoPickerController(controller: PhotoPickerController, shouldSelectAsset asset: PHAsset) -> Bool
func photoPickerController(controller: PhotoPickerController, didSelectAsset asset: PHAsset)
func photoPickerController(controller: PhotoPickerController, didDeselectAsset asset: PHAsset)

Present PhotoPicker

let photoPickerController = PhotoPickerController()
photoPickerController.delegate = self
presentViewController(photoPickerController, animated: true, completion: nil)

Localization

let localizedString: [String: String] = [
    "PhotoPicker.Cancel": LocalizationString("PhotoPicker.Cancel"),
    "PhotoPicker.OK": LocalizationString("PhotoPicker.OK"),
    "PhotoPicker.Send": LocalizationString("PhotoPicker.Send"),
    "PhotoPicker.Origin": LocalizationString("PhotoPicker.Origin"),
    "PhotoPicker.MaximumNumberOfSelection.Alert": LocalizationString("PhotoPicker.MaximumNumberOfSelection.Alert"),
    "PhotoPicker.Photos": LocalizationString("PhotoPicker.Photos"),
    "PhotoPicker.Videos": LocalizationString("PhotoPicker.Videos"),
    "PhotoPicker.Title" : LocalizationString("PhotoPicker.Title"),
    "PhotoPicker.VideoSelect.Alert": LocalizationString("PhotoPicker.VideoSelect.Alert")
]

Similar

Minimum Requirement

  • iOS 8.0

Release Notes

License

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

More Info

About

📷A image picker for iOS , written by Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.2%
  • Objective-C 0.8%