ViewMapScope

class ViewMapScope(val input: String, val index: Int)

Information passed into the viewMap callback in the input method.

The user can check the current character being transformed (via the ch property), but the entire input so far and the character's index into it are also provided in case the context helps with the mapping. It's expected that none of these values will be needed in many cases, e.g. masking a password, but you can refer to them if you need to!

For an example, to visually render all input text as uppercase (while the underlying input will be whatever case the user typed in), you could call:

input(viewMap = { ch.uppercaseChar() })

or for masking a password, simply:

input(viewMap = { '*' })

Constructors

Link copied to clipboard
constructor(input: String, index: Int)

Properties

Link copied to clipboard
val ch: Char

The current source character being mapped.

Link copied to clipboard
val index: Int

The index of the current character in the string being mapped.

Link copied to clipboard

The backing text associated with the input call.