Swiftpack.co -  whitesmith/WSTagsField as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An iOS text field that represents tags, hashtags, tokens in general.
.package(url: "https://github.com/whitesmith/WSTagsField.git", from: "5.4.0")


Carthage Compatible SwiftPM Compatible CocoaPods Compatible Swift 5.1 Platforms iOS Build Status License MIT

An iOS text field that represents tags, hashtags, tokens in general.



let tagsField = WSTagsField()
tagsField.layoutMargins = UIEdgeInsets(top: 2, left: 6, bottom: 2, right: 6)
tagsField.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
tagsField.spaceBetweenLines = 5.0
tagsField.spaceBetweenTags = 10.0
tagsField.font = .systemFont(ofSize: 12.0)
tagsField.backgroundColor = .white
tagsField.tintColor = .green
tagsField.textColor = .black
tagsField.fieldTextColor = .blue
tagsField.selectedColor = .black
tagsField.selectedTextColor = .red
tagsField.delimiter = ","
tagsField.isDelimiterVisible = true
tagsField.placeholderColor = .green
tagsField.placeholderAlwaysVisible = true
tagsField.keyboardAppearance = .dark
tagsField.returnKeyType = .next
tagsField.acceptTagOption = .space
tagsField.shouldTokenizeAfterResigningFirstResponder = true

// Events
tagsField.onDidAddTag = { field, tag in
    print("DidAddTag", tag.text)

tagsField.onDidRemoveTag = { field, tag in
    print("DidRemoveTag", tag.text)

tagsField.onDidChangeText = { _, text in

tagsField.onDidChangeHeightTo = { _, height in
    print("HeightTo", height)

tagsField.onValidateTag = { tag, tags in
    // custom validations, called before tag is added to tags list
    return tag.text != "#" && !tags.contains(where: { $0.text.uppercased() == tag.text.uppercased() })

print("List of Tags Strings:", tagsField.tags.map({$0.text}))



To install it, simply add the following line to your Cartfile:

github "whitesmith/WSTagsField"

Then run carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.


To install it, simply add the following line to your Podfile:

pod "WSTagsField"

Then run pod install with CocoaPods 1.8.0 or newer.

Swift Package Manager

Using Xcode 11, just go to "File" > "Swift Packages" > "Add Package Dependency..." and use this repository: https://github.com/whitesmith/WSTagsField.


Download all the source files and drop them into your project.


  • iOS 9.0+
  • Xcode 11 (Swift 5.1)


The best way to contribute is by submitting a pull request. We'll do our best to respond to your patch as soon as possible. You can also submit a new GitHub issue if you find bugs or have questions. :octocat:



This project was inspired by CLTokenInputView.


Stars: 1068
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

51 weeks ago

Changes included:

  • Changed access to tagViews to open to allow manipulation of specific tags views, i.e. tintColor (#143). Thanks @cdf1982.
  • Added shouldTokenizeAfterResigningFirstResponder flag (#141). Thanks @rizwan95.
  • Add prebuilt binaries for Xcode 11.6.


pod 'WSTagsField', '~> 5.4'


github "whitesmith/WSTagsField" ~> 5.4

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API