https://github.com/rlaguilar/multilinetextfield
Multiline Text Field - UITextField with multiple lines or UITextView with placeholder
https://github.com/rlaguilar/multilinetextfield
cocoapods ios multiline placeholder placeholdertextview swift4 uitextfield uitextview
Last synced: about 1 year ago
JSON representation
Multiline Text Field - UITextField with multiple lines or UITextView with placeholder
- Host: GitHub
- URL: https://github.com/rlaguilar/multilinetextfield
- Owner: rlaguilar
- License: mit
- Created: 2017-10-11T23:06:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-08T15:18:55.000Z (over 6 years ago)
- Last Synced: 2025-04-10T00:05:42.307Z (about 1 year ago)
- Topics: cocoapods, ios, multiline, placeholder, placeholdertextview, swift4, uitextfield, uitextview
- Language: Swift
- Homepage:
- Size: 174 KB
- Stars: 44
- Watchers: 1
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultilineTextField
[](https://travis-ci.org/rlaguilar/MultilineTextField)
[](http://cocoapods.org/pods/MultilineTextField)
[](http://cocoapods.org/pods/MultilineTextField)
[](http://cocoapods.org/pods/MultilineTextField)
This can be seen as a `UITextField` with multiple lines, but under the hood it is just a `UITextView` which aims to provide many of the functionalities currently available in the `UITextField` class. Currently the following functionalities are supported:
+ Multiple lines
+ Customizable left view
+ Customizable placeholder text
## Usage
### Via storyboards
Add a `UITextView` and set its custom class to `MultilineTextField`. From the storyboard you can customize the placeholder text and also an image to be shown at the left of the field text.
### Via code
First of all you have to import the library `import MultilineTextField`.
After that just create an instance of the view an customize its properties:
```swift
let textField = MultiplelineTextField(frame: textFieldFrame)
textField.leftView = UIImageView(image: image)
// or use the convenience property:
// textField.leftImage to assign an image directly
// below are properties that can be optionally customized
textField.placeholder = "This is my placeholder"
textField.placeholderColor = UIColor.red
textField.isPlaceholderScrollEnabled = true
textField.leftViewOrigin = CGPoint(x: 8, y: 8)
someView.addSubview(textField)
```
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
It requires Swift 4 and Xcode 9 or above
## Installation
MultilineTextField is available through Swift Package Manager and also [CocoaPods](http://cocoapods.org).
### Swift Package Manager
Select File > Swift Packages > Add Package Dependency. Enter `https://github.com/rlaguilar/MultilineTextField.git` in the "Choose Package Repository" dialog.
### CocoaPods
Simply add the following line to your Podfile:
```ruby
pod 'MultilineTextField'
```
## Author
Reynaldo Aguilar, [rlaguilar](https://twitter.com/rlaguilar_)
## License
MultilineTextField is available under the MIT license. See the LICENSE file for more info.