To run the example project, clone the repo, and run pod install
from the Example directory first.
Demo
UDPlaceholderTextView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'UDPlaceholderTextView'
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
Drag and drop the file UDPlaceholderTextView.swift
into your project folder. Make sure Copy Files is checked and file is added to target.
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:
You can change the properties from Storyboard as well.
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
placeholder - Placeholder Text
textView.placeholder = "Please enter your comments"
placeholderColor - Color of the placeholder text.
textView.placeholderColor = UIColor.red
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.
udbhateja, [email protected]
UDPlaceholderTextView is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 0 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics