RedMadRobot / input-mask-ios

User input masking library repo.
MIT License
578 stars 96 forks source link

Affinity calculation strategy based on the value length #72

Closed taflanidi closed 5 years ago

taflanidi commented 5 years ago

Prerequisites

Summary

Switch the mask if the entered value doesn't fit into the current mask but fits into another. See the example.

Motivation

Current .prefix and .wholeString affinity calculation strategies do not entirely cover the frequent case, when mask switching requires both input prefix correction & is based on the text length.

.wholeString strategy will allow to choose the wider mask if all the available formats have the same prefix. .prefix strategy won't allow to switch to wider mask.

Describe the solution you'd like

Add more AffinityCalculationStrategy cases with respect to the value length.

taflanidi commented 5 years ago

Implemented in 4.2.0.