TKSequenceTextField is an UITextField component that takes multiple masks and applies them in real-time on the user's input, based on the input's length.
To run the example project, clone the repo, and run pod install
from the Example directory first.
TKSequenceTextField is available through Tokenlab's TKPodSpec. To install it, simply add the following lines to your Podfile:
source 'https://github.com/tokenlab/TKPodSpecs'
pod 'TKSequenceTextField', '~> 0.1'
If you want to use it along with other CocoaPods components, you may need to add both sources. e.g:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/tokenlab/TKPodSpecs'
target 'CustomProject' do
pod 'Alamofire', '~> 4.0'
pod 'TKSequenceTextField', '~> 0.1'
end
note: "~> 0.1" means that we want version 0.1 and the versions up to 1.0, not including 1.0 and higher.
TKSequenceTextField can be used with a list of masks. e.g:
let sequenceTextField = TKSequenceTextField()
sequenceTextField.setMaskSequence(["**.**", "***-***", "$$-$$$"])
If you want no masks at all:
let sequenceTextField = TKSequenceTextField()
sequenceTextField.setMaskSequence([])
//or
sequenceTextField.setMaskSequence([""])
Use $ for digits: (
$$-$$ $$)
And * for characters: [a-zA-Z] (**-****)
This custom TextField will reorder its maskSequence by mask length (smaller to bigger)
Eduardo Domene Junior, eduardodomene@tokenlab.com.br
TKSequenceTextField is available under the MIT license. See the LICENSE file for more info.