Skip to content

Commit 2c72ca0

Browse files
128keatonricardopereira
authored andcommitted
Enhance: add acceptCurrentTextAsTag (#13)
Method to call to just take the text inside of the field and make it a tag.
1 parent 75df904 commit 2c72ca0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/WSTagsField.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ public class WSTagsField: UIView {
276276
repositionViews()
277277
}
278278

279+
public func acceptCurrentTextAsTag(){
280+
if let currentText = tokenizeTextFieldText() where (self.textField.text?.isEmpty ?? true) == false {
281+
self.addTag(currentText)
282+
}
283+
}
284+
279285
public var isEditing: Bool {
280286
return self.textField.editing
281287
}

0 commit comments

Comments
 (0)