Latest 1.0
License MIT
Platforms ios 8.0

Table of Contents

Swift 3.0 Carthage compatible CocoaPods License MIT Build Status
License MIT [CocoaPods]()


AAPickerView is simple and easy-to-use implementation for UITextField to use as UIPickerView and UIDatePicker written in swift. It allows to transform UITextField as UIPickerView and UIDatePicker to pick data easily. It is designed to present a picker view to select data in UITextField.



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


  • iOS 8.0+
  • Xcode 8.0+


AAPickerView can be installed using CocoaPods, Carthage, or manually.


AAPickerView is available through CocoaPods. To install CocoaPods, run:

$ gem install cocoapods

Then create a Podfile with the following contents:

source ''
platform :ios, '8.0'

target '<Your Target Name>' do
// Swift 3.2+ Compatibility
pod 'AAPickerView'
// Swift 4 Compatibility
pod 'AAPickerView', '~> 1.0'

Finally, run the following command to install it:

$ pod install


To install Carthage, run (using Homebrew):

$ brew update
$ brew install carthage

Then add the following line to your Cartfile:

github "EngrAhsanAli/AAPickerView" "master"

Then import the library in all files where you use it:

import AAPickerView

Manual Installation

If you prefer not to use either of the above mentioned dependency managers, you can integrate AAPickerView into your project manually by adding the files contained in the Classes folder to your project.

Getting Started

Create instance of AAPickerView

You just need to assign AAPickerView class to your UITextField and make the outlet:

@IBOutlet weak var picker: AAPickerView!

Now your UITextField is transformed as a picker view as AAPickerView.

Define picker type

Define type of picker you want to use in your text field. There are two types of pickers available in AAPickerView that are:

  • StringPicker for UIPickerView
  • DatePicker for UIDatePicker

Assign one of them as follow:

picker1.pickerType = .string(data: #String collection#)
picker2.pickerType = .date

Customise the toolbar

You can change UIToolbar colours like:

picker.toolbar.barTintColor = .darkGray
picker.toolbar.tintColor = .black

Customise StringPicker Label

You can get and customise the StringPicker label as UILabel:

let label = picker.pickerRow
label.font = UIFont(name: "American Typewriter", size: 30)

Customise UIDatePicker & DateFormatter

You can get your UIDatePicker and DateFormatter which is using behind your UITextField as:

let datePicker = picker.datePicker
datePicker?.datePickerMode = .date

let dateFormatter = picker.dateFormatter
dateFormatter.dateFormat = "dd/MM/YYYY" 

Listen changes thorough callbacks

You can listen the changes of data simply by using the following callback methods:

  • StringPicker:

    picker.valueDidSelected = { (index) in
    print("selectedString ", stringData[index as! Int])
  • DatePicker
    picker.valueDidSelected = { date in
    print("selectedDate ", date as! Date )

Contributions & License

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

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using AAPickerView in your app, send an email to Engr. Ahsan Ali

Latest podspec

    "name": "AAPickerView",
    "version": "1.0",
    "summary": "AAPickerView is simple and easy-to-use implementation for `UITextField` to use as `UIPickerView` and `UIDatePicker` written in swift.",
    "description": "AAPickerView allows to transform `UITextField` as `UIPickerView` and `UIDatePicker` to pick data easily. It is designed to present a picker view to select data in `UITextField`.",
    "homepage": "",
    "screenshots": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Engr. Ahsan Ali": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "AAPickerView/Classes/**/*"

Pin It on Pinterest

Share This