Skip to content

majid701/WSTagsField

 
 

Repository files navigation

WSTagsField

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

An iOS text field that represents different Tags.

WSTagsField

Usage

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.returnKeyType = .next
tagsField.acceptTagOption = .space

// Events
tagsField.onDidAddTag = { (_,_) in
    print("DidAddTag")
}

tagsField.onDidRemoveTag = { (_,_) in
    print("DidRemoveTag")
}

tagsField.onDidChangeText = { _, text in
    print("DidChangeText")
}

tagsField.onDidChangeHeightTo = { sender, height in
    print("HeightTo \(height)")
}

Installation

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"

You will also need to make sure you're opting into using frameworks:

use_frameworks!

Then run pod install with CocoaPods 1.1.0 or newer.

If your version of Swift supports the SPM, you just need to add WSTagsField as a dependency in your Package.swift:

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .Package(url: "https://github.com/whitesmith/WSTagsField.git", , versions: "2.0.0" ..< Version.max),
        ...
    ]
    ...
)

(Note that the Swift Package Manager is still in early design and development, for more information checkout its repository)

Manually

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

Requirements

  • iOS 8.0+
  • Xcode 9 (Swift 4.0)

Contributing

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:

Credits

Whitesmith

This project was inspired by CLTokenInputView.

About

An iOS text field that represents different Tags

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.0%
  • Ruby 2.9%
  • Objective-C 1.1%