From cf815e3194e43a1ed65a814f4faa434e935c8a3a Mon Sep 17 00:00:00 2001 From: 3ph Date: Wed, 7 Jun 2017 12:30:30 +1200 Subject: [PATCH 1/2] Updated tests --- Example/Tests/Tests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Example/Tests/Tests.swift b/Example/Tests/Tests.swift index fe2149d..2260b15 100644 --- a/Example/Tests/Tests.swift +++ b/Example/Tests/Tests.swift @@ -7,6 +7,8 @@ import CollectionPickerView class TableOfContentsSpec: QuickSpec { override func spec() { describe("these will fail") { + + /* it("can do maths") { expect(1) == 2 @@ -19,6 +21,7 @@ class TableOfContentsSpec: QuickSpec { it("will eventually fail") { expect("time").toEventually( equal("done") ) } + */ context("these will pass") { From 03d14cdba97aefa0d8649b81eaa2e96c729de30b Mon Sep 17 00:00:00 2001 From: Tomas Friml Date: Wed, 7 Jun 2017 14:04:11 +1200 Subject: [PATCH 2/2] Added usage tips --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00e47c1..db58090 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Version](https://img.shields.io/cocoapods/v/CollectionPickerView.svg?style=flat)](http://cocoapods.org/pods/CollectionPickerView) [![License](https://img.shields.io/cocoapods/l/CollectionPickerView.svg?style=flat)](http://cocoapods.org/pods/CollectionPickerView) [![Platform](https://img.shields.io/cocoapods/p/CollectionPickerView.svg?style=flat)](http://cocoapods.org/pods/CollectionPickerView) +![Swift](https://img.shields.io/badge/%20in-swift%203.1.1-orange.svg) Generic and customizable picker based on UICollectionView. Picker cells are fully @@ -18,9 +19,60 @@ Fork of AKPickerView-Swif Screenshot +## Usage + +Since this view is using `UICollectionView` internally you have to provide data same way as you would do with collection view (using dataSource). You can also use delegate if you want to handle item selection or underlaying UIScrollView callbacks. See example project for details. + +Set the direction to vertical. +```swift +pickerView.isHorizontal = false +``` + +Disable wheel effect of the picker. +```swift +pickerView.isFlat = true +``` + +Prevent center selection when scrolling. +```swift +pickerView.selectCenter = false +``` + +Set spacing between cells, default 10. +```swift +pickerView.cellSpacing = 10 +``` + +Set cell size (width for horizontal, height for vertical style), default 100. +```swift +pickerView.cellSize = 100 +``` + +Set wheel effect perspective representation. +```swift +pickerView.viewDepth = 2000 +``` + +Disable fading gradient mask. +```swift +pickerView.maskDisabled = true +``` + +Current selected index might be obtained from `selectedIndex`. +```swift +NSLog("\(pickerView.selectedIndex)") +``` + +And reload the picker view when any change in data set occurs. +```swift +pickerView.reloadData() +``` + + + ## Example -To run the example project, clone the repo, and run `pod install` from the Example directory first. +To run the example project, clone the repo, and run `pod install` from the Example directory first. Or simplest way is just to run `pod try`. ## Installation