Latest 2.1.2
Homepage https://github.com/iPhoNewsRO/RSTextViewMaster
License GNU
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors

Version
License: MIT
Platform
Swift 4.2

Intro

image

📱Easy custom placeholder and growing (iMessage-like) UITextView with customisation

You can easily adjust the color, font, and position of the placeholder.
The height of the textview automatically changes every time you increase or decrease the line in the textview.
You can specify a maxHeight property so the textview can start to scroll.

Requirements

  • iOS 9.0 or newer
  • Swift 4.2

Installation

Cocoapods

RSTextViewMaster is available through CocoaPods.

pod 'RSTextViewMaster'

Usage

import RSTextViewMaster

Set text

For the moment, please use textView.setText(text: String) to update textview’s text. By using .text settler, the placeholder won’t be removed. This will get fixed in future updates.

Customization

    isAnimate: Bool = true                                          
    maxLength: Int = 0                                              
    minHeight: CGFloat = 0                                          
    maxHeight: CGFloat = 0                                          

    placeHolder: String = ""                                        
    placeHolderFont: UIFont = UIFont.systemFont(ofSize: 17)         
    placeHolderColor: UIColor = UIColor(white: 0.8, alpha: 1.0)     
    placeHolderTopPadding: CGFloat = 0                              
    placeHolderBottomPadding: CGFloat = 0                           
    placeHolderRightPadding: CGFloat = 5                            
    placeHolderLeftPadding: CGFloat = 5                             

Programmatically

let textViewMaster = RSTextViewMaster()
textViewMaster.delegate = self       
inputView.addSubview(textViewMaster)

You will have to set constrains by code if you take this approach.

Storyboard

  1. TextView Set class to "RSTextViewMaster".
  2. Set delegate to it’s view controller
  3. Set a height constraint but check "remove at runtime". This way Xcode won’t bother you and the textview will work like magic

Check the demo for an example.

Delegate

RSTextViewMaster inherits from UITextViewDelegate.
You can also use UITextViewDelegate by default.
Added or modified functions

func growingTextView(growingTextView: RSTextViewMaster, shouldChangeTextInRange range:NSRange, replacementText text:String) -> Bool
func growingTextViewShouldReturn(growingTextView: RSTextViewMaster) 
func growingTextView(growingTextView: RSTextViewMaster, willChangeHeight height:CGFloat)
func growingTextView(growingTextView: RSTextViewMaster, didChangeHeight height:CGFloat)

Author

RSTextViewMaster is based on JeaSungLEE‘s work

License

RSTextViewMaster is available under the GNU license.

Latest podspec

{
    "name": "RSTextViewMaster",
    "version": "2.1.2",
    "summary": "RSTextViewMaster",
    "description": "Easy custom placeholder and growing (iMessage-like) UITextView with customisation",
    "homepage": "https://github.com/iPhoNewsRO/RSTextViewMaster",
    "license": {
        "type": "GNU",
        "file": "LICENSE.md"
    },
    "authors": {
        "Radu Ursache": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/iPhoNewsRO/RSTextViewMaster.git",
        "tag": "2.1.2"
    },
    "source_files": "RSTextViewMaster.swift",
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This