InputRangeTextField - admiral-team/admiralui-ios GitHub Wiki

Class

A control for selecting range of values from one value.


Declaration

public class InputRangeTextField: UIView, AnyAppThemable, AccessibilitySupport

Overview

InputRangeTextField allows you to select a value from the indicated range by swiping or using manual input.

Any text value (rubles, dollars, days, years, etc.) can be added to the range. In this case, the value is substituted only in the input field.

The Input Range element can be used independently of the input field. Change the position of the slider: In the layers, select Change kerning, then in the text options change the Letter Spacing (Kerning) parameter

Live example

Configure a InputRangeTextField

let inputRangeTextField = InputRangeTextField()
inputRangeTextField.name = name
inputRangeTextField.info = info
inputRangeTextField.minimumValue = 10
inputRangeTextField.maximumValue = 1000
inputRangeTextField.leadingText = "₽"
inputRangeTextField.placeholder = "10"
inputRangeTextField.text = String(Int(inputRangeTextField.value))
inputRangeTextField.keyboardType = .numberPad

InputRangeTextFieldDelegate

For handling change of InputRangeTextFieldDelegate, you need set delegate.

inputRangeTextField.delegate = self

The delegate must adopt the protocol InputRangeTextFieldDelegate. InputRangeTextFieldDelegate implements four methods:

@objc optional func inputRangeTextFieldSliderValue(_ slider: InputRangeTextField) -> Float
@objc optional func inputRangeTextFieldSliderValueDidChange(_ slider: InputRangeTextField) -> String?
@objc optional func inputRangeTextFieldSliderMinBorderDidChange(_ slider: InputRangeTextField) -> String?
@objc optional func inputRangeTextFieldSliderMaxBorderDidChange(_ slider: InputRangeTextField) -> String?

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.