NatSelect

public class NatSelect : UIView
extension NatSelect: UIPickerViewDelegate, UIPickerViewDataSource
extension NatSelect: UITextFieldDelegate

NatSelect is a class that represents the select component from the design system.

Example of usage:

   let select = NatSelect(textField: textField)
   select.configure(data: ["Item 1", "Item 2"])
   select.configure(data: [0: ["Item 1", "Item 2"], 1: ["Item 3", "Item 4"]])

   select.configure(format: "First: %@, Second: %@")

Requires

It’s necessary to configure the Design System with a theme or fatalError will be raised.

DesignSystem().configure(with: AvailableTheme)

Public Methods

  • Sets a dictionary to feed the component

    Example of usage:

    natSelect.configure(data: [0: ["Item 1", "Item 2"], 1: ["Item 3", "Item 4"]])
    

    Declaration

    Swift

    public func configure(data: [Int : [String]])

    Parameters

    data

    A Dictionary that feed the component

  • Sets a array of string to feed the component

    Example of usage:

    natSelect.configure(data: ["Item 1", "Item 2"])
    

    Declaration

    Swift

    public func configure(data: [String])

    Parameters

    data

    A Array of Strings that feed the component

  • Sets format to format the text inside of the text field

    Example of usage:

    natSelect.configure(format: "Selected: %@")
    

    Declaration

    Swift

    public func configure(format: String)

    Parameters

    format

    A String that format the text inside of the text field

  • Undocumented

    Declaration

    Swift

    public func numberOfComponents(in pickerView: UIPickerView) -> Int
  • Undocumented

    Declaration

    Swift

    public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
  • Undocumented

    Declaration

    Swift

    public func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
  • Undocumented

    Declaration

    Swift

    public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
  • Undocumented

    Declaration

    Swift

    public func textField(_ textField: UITextField,
                          shouldChangeCharactersIn range: NSRange,
                          replacementString string: String) -> Bool