Skip to content

Picker view popup with multiply rows selection written in Swift

License

Notifications You must be signed in to change notification settings

seak-source-code/TCPickerView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCPickerView

Picker view popup with multiply rows selection written in Swift.

Requirements

TimeIntervalPicker works on iOS 9 and higher. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation
  • UIKit

Installation

CocoaPods

You can use CocoaPods to install TimeIntervalPicker by adding it to your Podfile:

platform :ios, '9.0'
use_frameworks!
pod 'TCPickerView'

Manually

  1. Download and drop Classes and Assets folder in your project.
  2. Congratulations!

Example

import UIKit
import TCPickerView

class ViewController: UIViewController {

    @IBAction private func showButtonPressed(button: UIButton) {
        let picker = TCPickerView()
        picker.title = "Cars"
        let cars = [
            "Chevrolet Bolt EV",
            "Subaru WRX",
            "Porsche Panamera",
            "BMW 330e",
            "Chevrolet Volt",
            "Ford C-Max Hybrid",
            "Ford Focus"
        ]
        let values = cars.map { TCPickerView.Value(title: $0) }
        picker.values = values
        picker.completion = { (selectedIndexes) in
            for i in selectedIndexes {
                print(values[i].title)
            }
        }
        picker.show()
    }
}

License

This code is distributed under the terms and conditions of the MIT license.

About

Picker view popup with multiply rows selection written in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 90.7%
  • Ruby 9.3%