[![CI Status](http://img.shields.io/travis/Sumit Jagdev/SJTwitterTagInputTextView.svg?style=flat)](https://travis-ci.org/Sumit Jagdev/SJTwitterTagInputTextView)
SJTwitterTagInputTextView is a subclass of UIView, written in Swift, that enables the UIView to use as the "#" and "@" tag input view with suggestion list.
- ARC
- iOS8
To run the example project, clone the repo, and run pod install
from the Example directory first.
SJTwitterTagInputTextView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SJTwitterTagInputTextView"
import SJTwitterTagInputTextView
@IBOutlet var tagInputView : SJTwitterTagInputTextView!
tagInputView.delegate = self
//TODO : Please add height constraint and set id of constraint = "SJTextViewHeight"
//MARK : SJTwitterTagInputTextViewDelegate
func didSearchWithAtTag(tagString: String) {
// print("Current Search Word @ : ", tagString)
let predicate = NSPredicate(format: "SELF contains[cd] %@", tagString)
let array = allObjectList as NSArray!
let newArray = array.filteredArrayUsingPredicate(predicate)
tagInputView.allObjectList = newArray as! [String]
}
func didSearchWithHashTag(tagString: String) {
// print("Current Search Word # : ", tagString)
let predicate = NSPredicate(format: "SELF contains[cd] %@", tagString)
let array = allObjectList as NSArray!
let newArray = array.filteredArrayUsingPredicate(predicate)
tagInputView.allObjectList = newArray as! [String]
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("All @ Tags : ", tagInputView.getAllAtTags())
print("All # Tags : ", tagInputView.getAllHashTags())
}
Sumit Jagdev, [email protected]
SJTwitterTagInputTextView is available under the MIT license. See the LICENSE file for more info.