EAPicker 0.1.3

EAPicker 0.1.3

Maintained by Emre AYDIN, Emre AYDIN.



EAPicker 0.1.3

  • By
  • aydin-emre

EAPicker

CI Status Version License Platform

EAAlert example

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

EAPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EAPicker'

How To Use

Firstly, import EAAlert to your project

import EAPicker

After importing EAPicker you will be able to create a picker view either using storyboard or using swift code.

For instance, using storyboard, create an empty view and in Identity Inspector change class name as EAPicker and drag it to your swift class.

Add delegate, set title, and add values.

picker.setTitle("Title")
picker.values = ["Value 1", "Value 2", "Value 3"]

You can set initially selected row

picker.selectedRow = 1

You can hide title

picker.isTitleHidden = true

You can enable or disable picker

picker.setEnabled(false)

Delegate

Set picker delegate

picker.delegate = self

Add EAPickerDelegate to your view controller, and import necessary functions.

extension ViewController: EAPickerDelegate {
    
    func didSelectRow(_ pickerView: EAPicker, didSelectRow row: Int) {
        print("************* didSelectRow", row)
    }
    
    func doneButtonPressed(_ pickerView: EAPicker, didSelectRow row: Int) {
        print("************* doneButtonPressed", row)
    }
    
}

Customize

You can change title and value labels' color and font

picker.titleLabelColor = .red
picker.titleLabelFont = UIFont.boldSystemFont(ofSize: 20)

picker.valueLabelColor = .blue
picker.valueLabelFont = UIFont.systemFont(ofSize: 23)

Author

aydin-emre, www.emr.ee

License

EAPicker is available under the MIT license. See the LICENSE file for more info.