ElaWorkshop / TagListView

Simple and highly customizable iOS tag list view, in Swift.
MIT License
2.64k stars 492 forks source link

Suggestion: Please add search bar functionality #231

Open pawargb opened 5 years ago

pawargb commented 5 years ago

There is no search bar in this library and really appreciate if there would be one where user can on/off search bar. My Friend added it using this library but it took so much time and efforts for the same.

Below is the code she used and called below method whenever she adds/removes tag:

func addSearchTagView(){ let searchViewTag = TagView(title: " ") searchEmployeeTextField = UITextField(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 23)) if !ifPreviouslySearching.isEmpty || ifPreviouslySearching != ""{ searchEmployeeTextField.placeholder = "" searchEmployeeTextField.text = ifPreviouslySearching }else{ searchEmployeeTextField.placeholder = "To" searchEmployeeTextField.text = "" } searchEmployeeTextField.becomeFirstResponder()

    searchEmployeeTextField.font = UIFont(name: "Roboto-Regular", size: 17)!
    searchEmployeeTextField.becomeFirstResponder()
    searchEmployeeTextField.delegate = self
    searchEmployeeTextField.tintColor = UIColor.init(hexString: "354D80")
    searchEmployeeTextField.autocorrectionType = .no
    searchEmployeeTextField.placeHolderColor = UIColor.init(hexString: "313E5A")
    searchEmployeeTextField.backgroundColor = UIColor.clear
    searchViewTag.addSubview(searchEmployeeTextField)
    searchViewTag.paddingX = 10
    searchViewTag.paddingY = 5
    searchViewTag.titleLineBreakMode = .byTruncatingMiddle
    searchViewTag.enableRemoveButton = false
    searchViewTag.tagBackgroundColor = UIColor.clear
    searchViewTag.clipsToBounds = true
    self.tagListOuterview.addTagView(searchViewTag)
}