DoubleInputRangeTextField - admiral-team/admiralui-ios GitHub Wiki

Class

A control for selecting range of values from two values.


Declaration

public class DoubleInputRangeTextField: UIView, AnyAppThemable, AccessibilitySupport

Overview

DoubleRangeTextField 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 DoubleInputRangeTextField

Configure DoubleInputRangeTextField with minimum and maximum values, lower and upper value, text on right from value

let doubleInputRangeTextField = DoubleInputRangeTextField()
doubleInputRangeTextField.name = "DoubleInputRangeTextField"
doubleInputRangeTextField.minimumValue = 10
doubleInputRangeTextField.maximumValue = 1000
doubleInputRangeTextField.lowerValue = 100
doubleInputRangeTextField.upperValue = 500
doubleInputRangeTextField.leadingText = "₽"
doubleInputRangeTextField.trailingText = "₽"
doubleInputRangeTextField.keyboardType = .numberPad

DoubleInputRangeTextFieldDelegate

For handling change of DoubleInputRangeTextField, you need set delegate.

doubleInputRangeTextField.delegate = self

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

@objc optional func inputRangeTextFieldSliderValue(_ slider: DoubleInputRangeTextField) -> Float
@objc optional func inputRangeTextFieldSliderValueDidChange(_ slider: DoubleInputRangeTextField) -> String?
@objc optional func inputRangeTextFieldSliderMinBorderDidChange(_ slider: DoubleInputRangeTextField) -> String?
@objc optional func inputRangeTextFieldSliderMaxBorderDidChange(_ slider: DoubleInputRangeTextField) -> 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.