This is QIWI's implementation of text field/view according to Material Design. It supports formattable input with masks since it uses FormattableTextView.
This component is highly customizable via styles in real time.
You can check user input for validity manually by firing validate()
method (it checks the text according to actionValidator
property) or automatically during user's input by setting inputValidator
property.
Placeholder has 2 modes: animatable and normal.
pod 'FormattableTextView', :git => 'https://github.com/qiwi/FormattableTextView'
pod 'MaterialTextView', :git => 'https://github.com/qiwi/MaterialTextView'
git "https://github.com/qiwi/MaterialTextView" "master"
let tv = MaterialTextView(.init(style: .defaultStyle))
let viewModel = MaterialTextViewModel(
style: .defaultStyle,
placeholder: .init(type: .alwaysOnTop, text: "Telephone number"),
formats: ["+d (ddd) ddd-dd-dd", "+ddddddddddddddddd"]
)
viewModel.formatSelectionStrategy = .startFromFirst
let tv = MaterialTextView(viewModel)
if #available(iOS 10.0, *) {
tv.textComponent.textContentType = .telephoneNumber
tv.textComponent.keyboardType = .numberPad
tv.textComponent.allowSmartSuggestions = true
}
Distributed under the MIT License.
link |
Stars: 9 |
Last commit: 1 year ago |
Full Changelog: https://github.com/qiwi/MaterialTextView/compare/4.0.0...5.0.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics