Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qiwi/materialtextview
Material text view
https://github.com/qiwi/materialtextview
Last synced: 4 days ago
JSON representation
Material text view
- Host: GitHub
- URL: https://github.com/qiwi/materialtextview
- Owner: qiwi
- License: mit
- Created: 2019-03-28T10:36:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-02T14:49:28.000Z (over 2 years ago)
- Last Synced: 2024-07-16T14:21:14.161Z (4 months ago)
- Language: Swift
- Size: 1.09 MB
- Stars: 9
- Watchers: 10
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MaterialTextView
## Description
This is QIWI's implementation of text field/view according to Material Design. It supports formattable input with masks since it uses [FormattableTextView](https://github.com/qiwi/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.
## Requirements
* iOS 9.0+## Installation
### CocoaPods
```
pod 'FormattableTextView', :git => 'https://github.com/qiwi/FormattableTextView'
pod 'MaterialTextView', :git => 'https://github.com/qiwi/MaterialTextView'
```### Carthage
```
git "https://github.com/qiwi/MaterialTextView" "master"
```## Usage
### Example 1
```swift
let tv = MaterialTextView(.init(style: .defaultStyle))
```### Example 2
```swift
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
}
```## License
Distributed under the MIT License.