The CSNPlaceholderTextView library is a powerful and customizable UITextView subclass that provides a placeholder text functionality. This UITextView extension allows you to easily create and manage placeholder text for your UITextView instances.
Features
- Set and customize placeholder text for UITextView.
- Supports dynamic font changes.
- Customize placeholder color, font, and alignment.
- Automatically hides placeholder when user starts typing.
- Placeholder text can be styled independently from main text.
Installation
To install CSNPlaceholderTextView in your Xcode project, you can use either CocoaPods or Carthage.
CocoaPods
To integrate CSNPlaceholderTextView using CocoaPods, add the following line to your Podfile:
pod 'CSNPlaceholderTextView'
Carthage
If you prefer Carthage, add the following line to your Cartfile:
github "hussainshahzad28/CSNPlaceholderTextView"
Usage
To use CSNPlaceholderTextView in your project, simply follow these steps:
Step 1
Import the CSNPlaceholderTextView module:
import CSNPlaceholderTextView
Step 2
Create an instance of CSNPlaceholderTextView, either programmatically or using Interface Builder:
// Programmatically
let textView = CSNPlaceholderTextView(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
// Using Interface Builder
@IBOutlet weak var textView: CSNPlaceholderTextView!
Step 3
Set the placeholder text for your CSNPlaceholderTextView:
textView.placeholder = "Enter your text here"
Additional Customization
CSNPlaceholderTextView offers several customization options that you can use to enhance the appearance and behavior of your UITextView instances. Some of the additional customization options include:
- Setting custom placeholder color
- Setting custom placeholder font
- Aligning the placeholder text
- Customizing main text’s attributes
For more advanced customization options and methods, please refer to the library’s documentation.
Contributing
If you have ideas for new features or improvements, we would love to have your contributions. To contribute to CSNPlaceholderTextView, follow these steps:
1. Fork this repository.
2. Create a branch: git checkout -b my-feature-branch
.
3. Make your changes and commit them: git commit -m 'Add some feature'
.
4. Push to the original branch: git push origin my-feature-branch
.
5. Create a pull request.
We appreciate all contributions and will review your pull requests as soon as possible!
License
CSNPlaceholderTextView is available under the MIT license. See the LICENSE file for more information.