WSTagsField icon indicating copy to clipboard operation
WSTagsField copied to clipboard

How to add delete button next to the already added tag?

Open kuldeep13990 opened this issue 2 years ago • 2 comments

How can I add a delete button next to the tag? And pressing that button the particular tag should be deleted?

kuldeep13990 avatar Feb 03 '23 11:02 kuldeep13990

you need to modify the code, use this:

        textField.onDeleteBackwards = { [weak self] in
            if self?.readOnly ?? true {
                return
            }

            /*
             // Original
            if self?.isTextFieldEmpty ?? true, let tagView = self?.tagViews.last {
                self?.selectTagView(tagView, animated: true)
                self?.textField.resignFirstResponder()
            }
             */
            
            if let tagView = self?.tagViews.last {
                self?.removeTag(tagView.displayText)
            }

mabeljarsdel avatar May 01 '23 05:05 mabeljarsdel

I know, maybe is too late for you, (I'm not the author), just played with this repo a little.

mabeljarsdel avatar May 01 '23 05:05 mabeljarsdel