Skip to content

mandrusiaks/SMTextView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTextView

CI Status Version License Platform

A custom implementation of UITextView with a placeholder and character count. This implementation contains the ability to customize top, left, and right insets individually. SMTextView is compatible with Interface Builder. SMTextView also contains a character count that can be enabled/disabled. To disable, simply set isCharacterCountEnabled to false.

NOTE: Due to character count label, bottomInset is currently no longer customizable. This may be re-enabled in the future. If character count is disabled, bottomInset = topInset.

SMTextView SMTextView2

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

Instead of using Interface Builder, you can customize properties manually in code.

By default, SMTextView's character count is enabled. To hide the character count for SMTextView, simply set isCharacterCountEnabled = false

Optionally, you can set maxCharacterCount. The default character count is 100.

@IBOutlet weak var textView: SMTextView!

...

override func viewDidLoad() {
    super.viewDidLoad()
    textView.placeholder = "Enter details about the event."
    textView.placeholderColor = .purple
    textView.topInset = 45
    textView.leftInset = 15
    textView.rightInset = 15
    textView.maxCharacterCount = 200
}

Requirements

Installation

CocoaPods

SMTextView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SMTextView"

Manual

Alternatively, you can simply add SMTextView.swift to your project.

License

SMTextView is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published