Swiftpack.co - udbhateja/UDPlaceholderTextView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
udbhateja/UDPlaceholderTextView
A subclass of UITextView with add-in capabilities for Placeholder.
.package(url: "https://github.com/udbhateja/UDPlaceholderTextView.git", from: "0.1.0")

UDPlaceholderTextView

Version License Platform

TUDPlaceholderTextView

Example

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

Demo

UDPlaceholderTextView

Requirements

  • iOS 9.0+
  • Swift 5+

Installation

Cocoapods

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

pod 'UDPlaceholderTextView'

Swift Package Manager

To install UDPlaceholderTextView package into your packages, add a reference to UDPlaceholderTextView and a targeting release version in the dependencies section in Package.swift file:

import PackageDescription

let package = Package(
   name: "YOUR_PROJECT_NAME",
   products: [],
   dependencies: [
       .package(url: "https://github.com/udbhateja/UDPlaceholderTextView.git", from: "0.1.0")
   ]
)

To install UDPlaceholderTextView package via Xcode

Manually

Drag and drop the file UDPlaceholderTextView.swift into your project folder. Make sure Copy Files is checked and file is added to target.

Usage

In case of Cocoapods

import UDPlaceholderTextView

1. Using Code

var textView: UDPlaceholderTextView!
override func viewDidLoad() {
   super.viewDidLoad()
   // Do any additional setup after loading the view, typically from a nib.
   textView = UDPlaceholderTextView(frame: CGRect(x: 0, y: 0, width: 100.0, height: 100.0))
   textView.placeholder = "Please enter your comments"
   textView.placeholderColor = UIColor.red
}

2. Using Storyboard

Drag a UITextView object in your ViewController. Change the class to UDPlaceholderTextView in Identity Inspector.

Refer screenshot below:

UDPlaceholderTextView

You can change the properties from Storyboard as well.

UDPlaceholderTextView

In your code you can access the text normally like UITextView. All other UITextView properties and methods can be accessed normally.

@IBOutlet weak var textView: UDPlaceholderTextView!
let text = textView.text

Properties

  • placeholder - Placeholder Text

    textView.placeholder = "Please enter your comments"
    
  • placeholderColor - Color of the placeholder text.

    textView.placeholderColor = UIColor.red
    

Contributions

I'd love to see you contributing to this project by proposing or adding features, reporting bugs, or spreading the word. Any help or contribution is appreciated.

Author

udbhateja, udaybhateja@ymail.com

https://bit.ly/udbhateja

License

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

GitHub

link
Stars: 0
Last commit: 6 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics