Skip to content

Commit

Permalink
Merge pull request #63 from nohana/release/0.7.1
Browse files Browse the repository at this point in the history
Release/0.7.1
  • Loading branch information
haranicle authored Oct 2, 2016
2 parents c16999c + 22971c9 commit ef9b35d
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Demo/DemoListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
func showDisableToPickAssetsPicker() {
let picker = NohanaImagePickerController()
picker.delegate = self
picker.canPickAsset = { (asset:AssetType) -> Bool in
picker.canPickAsset = { (asset:Asset) -> Bool in
return asset.identifier % 2 == 0
}
present(picker, animated: true, completion: nil)
Expand Down
2 changes: 1 addition & 1 deletion NohanaImagePicker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NohanaImagePicker'
s.version = '0.7.0'
s.version = '0.7.1'
s.summary = 'A multiple image picker for iOS app.'
s.homepage = 'https://github.com/nohana/NohanaImagePicker'
s.license = { :type => 'Apache License v2', :file => 'LICENSE' }
Expand Down
4 changes: 2 additions & 2 deletions NohanaImagePicker/AssetCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AssetCell: UICollectionViewCell {
@IBOutlet weak var overlayView: UIView!

weak var nohanaImagePickerController: NohanaImagePickerController?
var asset: AssetType?
var asset: Asset?

override func willMove(toSuperview newSuperview: UIView?) {
super.willMove(toSuperview: newSuperview)
Expand Down Expand Up @@ -52,7 +52,7 @@ class AssetCell: UICollectionViewCell {
self.overlayView.isHidden = !pickButton.isSelected
}

func update(asset: AssetType, nohanaImagePickerController: NohanaImagePickerController) {
func update(asset: Asset, nohanaImagePickerController: NohanaImagePickerController) {
self.asset = asset
self.nohanaImagePickerController = nohanaImagePickerController
self.pickButton.isSelected = nohanaImagePickerController.pickedAssetList.isPicked(asset)
Expand Down
6 changes: 3 additions & 3 deletions NohanaImagePicker/ItemListType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

public protocol ItemListType: Collection {
public protocol ItemList: Collection {
associatedtype Item
var title:String { get }
func update(_ handler:(() -> Void)?)
subscript (index: Int) -> Item { get }
}

extension ItemListType {
extension ItemList {
public func index(after i: Int) -> Int {
return i + 1
}
}

public protocol AssetType {
public protocol Asset {
var identifier:Int { get }
func image(targetSize:CGSize, handler: @escaping (ImageData?) -> Void)
}
Expand Down
6 changes: 3 additions & 3 deletions NohanaImagePicker/NohanaImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ open class NohanaImagePickerController: UIViewController {
open var shouldShowMoment: Bool = true
open var shouldShowEmptyAlbum: Bool = false
open var toolbarHidden: Bool = false
open var canPickAsset = { (asset:AssetType) -> Bool in
open var canPickAsset = { (asset:Asset) -> Bool in
return true
}
lazy var assetBundle:Bundle = {
Expand Down Expand Up @@ -127,11 +127,11 @@ open class NohanaImagePickerController: UIViewController {
albumListViewController.nohanaImagePickerController = self
}

open func pickAsset(_ asset: AssetType) {
open func pickAsset(_ asset: Asset) {
_ = pickedAssetList.pick(asset: asset)
}

open func dropAsset(_ asset: AssetType) {
open func dropAsset(_ asset: Asset) {
_ = pickedAssetList.drop(asset: asset)
}
}
Expand Down
4 changes: 2 additions & 2 deletions NohanaImagePicker/PhotoKitAlbumList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import Photos

public class PhotoKitAlbumList: ItemListType {
public class PhotoKitAlbumList: ItemList {

private var albumList:[Item] = []
private let assetCollectionTypes: [PHAssetCollectionType]
Expand All @@ -37,7 +37,7 @@ public class PhotoKitAlbumList: ItemListType {
}
}

// MARK: - ItemListType
// MARK: - ItemList

public typealias Item = PhotoKitAssetList

Expand Down
4 changes: 2 additions & 2 deletions NohanaImagePicker/PhotoKitAsset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import Photos

public class PhotoKitAsset :AssetType {
public class PhotoKitAsset :Asset {

let asset: PHAsset

Expand All @@ -27,7 +27,7 @@ public class PhotoKitAsset :AssetType {
return asset as PHAsset
}

// MARK: - AssetType
// MARK: - Asset

public var identifier:Int {
return asset.localIdentifier.hash
Expand Down
4 changes: 2 additions & 2 deletions NohanaImagePicker/PhotoKitAssetList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Photos

open class PhotoKitAssetList :ItemListType {
open class PhotoKitAssetList :ItemList {

fileprivate let mediaType: MediaType
open let assetList: PHAssetCollection
Expand All @@ -28,7 +28,7 @@ open class PhotoKitAssetList :ItemListType {
update()
}

// MARK: - ItemListType
// MARK: - ItemList

public typealias Item = PhotoKitAsset

Expand Down
14 changes: 7 additions & 7 deletions NohanaImagePicker/PickedAssetList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

import Foundation

class PickedAssetList: ItemListType {
class PickedAssetList: ItemList {

var assetlist: Array<AssetType> = []
var assetlist: Array<Asset> = []
weak var nohanaImagePickerController: NohanaImagePickerController?

// MARK: - ItemListType
// MARK: - ItemList

typealias Item = AssetType
typealias Item = Asset

var title: String {
return "Selected Assets"
Expand All @@ -49,7 +49,7 @@ class PickedAssetList: ItemListType {

// MARK: - Manage assetlist

func pick(asset: AssetType) -> Bool {
func pick(asset: Asset) -> Bool {
guard !isPicked(asset) else {
return false
}
Expand Down Expand Up @@ -83,7 +83,7 @@ class PickedAssetList: ItemListType {

}

func drop(asset: AssetType) -> Bool {
func drop(asset: Asset) -> Bool {
let assetsCountBeforeDropping = self.count
if asset is PhotoKitAsset {
if let canDrop = nohanaImagePickerController!.delegate?.nohanaImagePicker?(nohanaImagePickerController!, willDropPhotoKitAsset: (asset as! PhotoKitAsset).originalAsset, pickedAssetsCount: assetsCountBeforeDropping) , !canDrop {
Expand All @@ -109,7 +109,7 @@ class PickedAssetList: ItemListType {
return true
}

func isPicked(_ asset: AssetType) -> Bool {
func isPicked(_ asset: Asset) -> Bool {
return assetlist.contains{ $0.identifier == asset.identifier }
}

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ picker.shouldShowMoment = shouldShowEmptyAlbum = true
picker.shouldShowEmptyAlbum = true
// Disable to pick asset
picker.canPickAsset = { (asset:AssetType) -> Bool in
picker.canPickAsset = { (asset:Asset) -> Bool in
return false
}
Expand All @@ -76,7 +76,7 @@ ColorConfig.backgroundColor = UIColor.redColor()
Use [Carthage](https://github.com/Carthage/Carthage).

- Add `github "nohana/NohanaImagePicker"` to your Cartfile.
- If you want to use Swift2.3, add `github "nohana/NohanaImagePicker", "0.6.0"` instead.
- If you want to use Swift2.3, add `github "nohana/NohanaImagePicker", "0.6.1"` instead.
- If you want to use Swift2.2, add `github "nohana/NohanaImagePicker", "0.5.0"` instead.
- Run `carthage update`.

Expand All @@ -91,7 +91,7 @@ Use [CocoaPods](https://cocoapods.org/).
pod "NohanaImagePicker"
```

- If you want to use Swift2.3 write `pod "NohanaImagePicker", "0.6.0"` instead of `pod "NohanaImagePicker"`.
- If you want to use Swift2.3 write `pod "NohanaImagePicker", "0.6.1"` instead of `pod "NohanaImagePicker"`.

- Run `pod install`.

Expand Down

0 comments on commit ef9b35d

Please sign in to comment.