Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename imagePickerController(_:didDeselectImageAsset:) #12

Merged
merged 4 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Pickle (1.0.0)
- Pickle (1.1.0)
- SwiftLint (0.18.1)

DEPENDENCIES:
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Pickle: c9b9e1ddd4c9baaef4d3561ecbe99d71de35fbb6
Pickle: 1482e432a75aa9454d254916765f6079668e51c1
SwiftLint: b467d08f5b25dc3b3cfed243d8e1b74b91714c67

PODFILE CHECKSUM: deb6efd06d1eb162719911e286f38d05b1590fdb
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ else
ruby -pi -e "gsub(/:\s\d+\.\d+\.\d+/i, \": "$(version)"\")" .jazzy.yml
cd Example && xcrun agvtool new-marketing-version $(version)
xcrun agvtool new-marketing-version $(version)
bundle exec pod install --project-directory=Example
endif

carthage:
Expand Down
8 changes: 4 additions & 4 deletions Pickle/Classes/ImagePickerConfigurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UIKit
/// The ImagePickerConfigurable protocol defines the customizable properties of ImagePickerController.
public protocol ImagePickerConfigurable {

// MARK: - UINavigationItem
// MARK: - Navigation Item

/// A custom bar button item displayed on the left (or leading) edge of the navigation bar when the receiver is the top navigation item.
var cancelBarButtonItem: UIBarButtonItem? { get }
Expand Down Expand Up @@ -71,7 +71,7 @@ public protocol ImagePickerConfigurable {
/// Specifies the number of photo selections is allowed in ImagePickerController.
var allowedSelections: ImagePickerSelection? { get }

// MARK: -
// MARK: - Hint Label

/// The margin for the text of the hint label.
var hintTextMargin: UIEdgeInsets? { get }
Expand All @@ -81,9 +81,9 @@ public protocol ImagePickerConfigurable {
/// An enum that represents photo selections allowed in ImagePickerController.
public enum ImagePickerSelection {

// Unlimited number of selections.
/// Unlimited number of selections.
case unlimited

// Limited selections with an associated number.
/// Limited selections with an associated number.
case limit(to: Int)
}
11 changes: 6 additions & 5 deletions Pickle/Classes/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
// See https://github.com/carousell/pickle/graphs/contributors for the list of project authors
//

// swiftlint:disable file_length

import UIKit
import Photos

// swiftlint:disable file_length
/// Carousell flavoured image picker with multiple photo selections.
@objc
open class ImagePickerController: UINavigationController {

Expand Down Expand Up @@ -210,11 +212,10 @@ open class ImagePickerController: UINavigationController {
}


// MARK: - UIImagePickerControllerDelegate


extension ImagePickerController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {

// MARK: - UIImagePickerControllerDelegate

public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
defer {
picker.dismiss(animated: true, completion: nil)
Expand Down Expand Up @@ -291,7 +292,7 @@ extension ImagePickerController: PhotoGalleryViewControllerDelegate {
internal func photoGalleryViewController(_ controller: PhotoGalleryViewController, didTogglePhoto asset: PHAsset) {
if let selectedIndex = selectedAssets.index(of: asset) {
selectedAssets.remove(at: selectedIndex)
imagePickerDelegate?.imagePickerController?(self, didUnselectImageAsset: asset)
imagePickerDelegate?.imagePickerController?(self, didDeselectImageAsset: asset)
} else {
switch allowedSelections {
case .limit(to: let number) where 1 < number && selectedAssets.count < number:
Expand Down
6 changes: 3 additions & 3 deletions Pickle/Classes/ImagePickerControllerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public protocol ImagePickerControllerDelegate: UINavigationControllerDelegate {
/// Optional. Asks the delegate for the transitioning delegate for presenting the album list. The default transition is used if not implemented.
@objc optional func imagePickerController(_ picker: ImagePickerController, transitioningDelegateForPresentingAlbumsViewController controller: UIViewController) -> UIViewControllerTransitioningDelegate

/// Optional. Tells the delegate that the user seleced an image asset.
/// Optional. Tells the delegate that the user selected an image asset.
@objc optional func imagePickerController(_ picker: ImagePickerController, didSelectImageAsset asset: PHAsset)

/// Optional. Tells the delegate that the user unseleced an image asset.
@objc optional func imagePickerController(_ picker: ImagePickerController, didUnselectImageAsset asset: PHAsset)
/// Optional. Tells the delegate that the user deselected an image asset.
@objc optional func imagePickerController(_ picker: ImagePickerController, didDeselectImageAsset asset: PHAsset)
}
2 changes: 1 addition & 1 deletion Pickle/Classes/PhotoAlbumsTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal final class PhotoAlbumsTableView: UITableView {

// MARK: - Initialization

convenience init(configuration: ImagePickerConfigurable? = nil) {
internal convenience init(configuration: ImagePickerConfigurable? = nil) {
self.init(frame: .zero, style: .plain)

let color = configuration?.photoAlbumsNavigationBarShadowColor
Expand Down