GithubHelp home page GithubHelp logo

carousell / pickle Goto Github PK

View Code? Open in Web Editor NEW
59.0 23.0 25.0 1.68 MB

Carousell flavoured image picker with multiple photo selections.

Home Page: https://carousell.github.com/pickle

License: Apache License 2.0

Swift 91.92% Ruby 6.04% Makefile 1.43% Objective-C 0.62%
swift ios image-picker camera cocoapods carthage

pickle's Introduction

Pickle

Build Status Carthage compatible CocoaPods Compatible Platform Swift 4.2

Carousell image picker.

  • Multiple image selections across albums
  • Picking photos in the desired order
  • Customizable theme

Usage

import Pickle

The usage is similiar to UIImagePickerController:

let picker = ImagePickerController()
picker.delegate = self as? ImagePickerControllerDelegate
present(picker, animated: true, completion: nil)

Display preselected images:

let assets: [PHAsset] = []
let picker = ImagePickerController(selectedAssets: assets)

Update selectedAssets with new values and update the UI. It won't trigger any delegate callbacks.

func updateSelectedAssets(with assets: [PHAsset])

ImagePickerController will request permission to access Photos if needed when it's presented.

Delegate

ImagePickerControllerDelegate is responsible for dismissing the image picker. Required delegate methods:

/// Asks the delegate if the image picker should launch camera with certain permission status.
func imagePickerController(_ picker: ImagePickerController, shouldLaunchCameraWithAuthorization status: AVAuthorizationStatus) -> Bool

/// Tells the delegate that the user picked image assets. The delegate is responsible for dismissing the image picker.
func imagePickerController(_ picker: ImagePickerController, didFinishPickingImageAssets assets: [PHAsset])

/// Tells the delegate that the user cancelled the pick operation. The delegate is responsible for dismissing the image picker.
func imagePickerControllerDidCancel(_ picker: ImagePickerController)

Appearance

Customize the appearance with a modified Parameters struct, or any type that conforms to ImagePickerConfigurable.

var parameters = Pickle.Parameters()
parameters.allowedSelections = .limit(to: 4)
let picker = ImagePickerController(configuration: parameters)

See ImagePickerConfigurable.swift for a full list of configurable properties.

Camera

UIImagePickerController with sourceType = .camera is used as the default camera on devices. Launch a customized camera from the image gallery by providing a CameraCompatible type or a closure that returns a configured camera controller instance.

let picker = ImagePickerController(
  selectedAssets: [],
  configuration: Pickle.Parameters(),
  cameraType: UIImagePickerController.self
)
let initializer = {
  return UIImagePickerController()
}

let picker = ImagePickerController(
  selectedAssets: [],
  configuration: Pickle.Parameters(),
  camera: initializer
)

Documentation

Pickle Reference

https://carousell.github.io/pickle

Example Setups

Install CocoaPods:

gem install cocoapods

Set up the development pods:

make bootstrap

Requirements

Pickle iOS Xcode Swift
>= 1.0.0 8.0+ 8.3.3 Swift 3.1
>= 1.2.0 9.0+ 8.3.3 Swift 3.1
>= 1.3.0 9.0+ 9.2 Swift 4.0

Installation

Create a Podfile with the following specification and run pod install.

platform :ios, '9.0'
use_frameworks!

pod 'Pickle'

Create a Cartfile with the following specification and run carthage bootstrap. Follow the instructions to add the framework to your project.

github "carousell/pickle"

Contributing

Thank you for being interested in contributing to this project. Check out the CONTRIBUTING document for more info.

About

Carousell

Pickle is created and maintained by Carousell. Help us improve this project! We'd love the feedback from you.

We're hiring! Find out more at http://careers.carousell.com/

License

Pickle is released under Apache License 2.0. See LICENSE for more details.

pickle's People

Contributors

amelia2801 avatar bcylin avatar daveluong avatar jianyaoang avatar mttcrsp avatar rance-attack avatar shujin avatar tflhyl avatar wanewang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pickle's Issues

iOS14?

Are you guys going to make this work with iOS14?

Suggession for Dynamic Label Count Change

Hello,
I found a minor issue. I set the max selection 10.
let allowedSelections: ImagePickerSelection? = .limit(to: 10)

It should be reflect on CarousellImagePickerController Subtitle. See Screenshot.

img_0363

Something wrong with Carthage & Xcode 10.2

Hi.

Im facing this issue when I want to use this library with Carthage.

it says: Dependency "pickle" has no shared framework schemes for any of the platforms: iOS

I tried it on two different MacBooks, other Carthage libraries does not had such issue.

I use Xcode 10.2.

It works fine with Xcode 10.1 & earlier though.

No permission dialog on iOS11 when permission is denied

Steps to reproduce

Go to Device Settings
Select Pickle Example
Select Photos, Select "Never"
Then, launch Pickle Example
Select any
Here, you will see the old image picker format, even though you do not give Picker Example access to Photos.app
Then, select a photo
You will see a blank page that is unresponsive, requiring you to kill app

Actual outcome
unresponsive page

Expected outcome
If access to Photos is disabled, client should show a page that informs you that access is required before proceeding to Sell Form. See attached image for what the prompt is on production for iOS10 and below


Upon initial investigation, it appears to be bug in UIImagePicker in iOS11.

Feature: make disabled done button optional

Feature: make disabled done button optional

What happens
When selecting 3 photos, done button is enabled and will close the picker. When opening again to deselect the 3 photos, the done button is disabled when selection = 0.

Expected
Done button is enabled even if selected photos = 0. So that a user can deselect previous selected photos.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.