UITextField

extension UITextField

Extension UITextField and class PickerView provide a simple data selector.

Example:

@IBOutlet var calendarSelector: UITextField!

override func viewDidLoad() { super.viewDidLoad()

calendarSelector.loadDropdownData(data: [“A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, “I”], selectionHandler: { selectedText in print(“selected: (selectedText)”) }) }

  • Attaches a PickerView to the UITextField input field.

    Declaration

    Swift

    func loadDropdownData(data: [String], selectionHandler: @escaping (_ selectedText: String) -> Void)

    Parameters

    data

    array of strings to be presented for selection by the picker

    selectionHandler

    on selection callback will be called, with the selected string