• Stars
    star
    1,279
  • Rank 35,292 (Top 0.8 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

WSTagsField

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.

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.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
    print("DidChangeText")
}

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}))

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"

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.

Manually

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

Requirements

  • iOS 9.0+
  • Xcode 11 (Swift 5.1)

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.

More Repositories

1

rubycritic

A Ruby code quality reporter
Ruby
3,289
star
2

hawkpost

Generate links that users can use to submit messages encrypted with your public key.
Python
944
star
3

MeasureThings

ARKit framework demo for our article
Swift
106
star
4

guard-rubycritic

Real time Ruby code smell detector
Ruby
45
star
5

capistrano-recipes

Our set of Capistrano Recipes
Ruby
12
star
6

quoi-app

Your Quiz Nights gone digital.
JavaScript
11
star
7

ulid

Universally Unique Lexicographically Sortable Identifier (Objective-C wrapper of the C++ lib)
C++
11
star
8

flooper

Use flex order to create an infinite animated loop of items.
JavaScript
10
star
9

react-native-template

A template to kickstart your React Native app!
JavaScript
9
star
10

meteor-motion

Ruby
9
star
11

saferpay-gem

Ruby
8
star
12

quoi-mobile

A mobile quiz app inspired by Buzz and Dr. Why.
JavaScript
8
star
13

WSAugmentedCamera

iOS Camera Manager helper for Augmented Reality implementations (experiment)
Swift
7
star
14

fig-tree

A collection of Fig development environments.
Shell
7
star
15

qnorr

Because there are moments in life when tastier is better. 🍆
CSS
7
star
16

WSLogger

An extensible iOS logger on top of OSLog
Swift
6
star
17

surveyor2

A Rails gem that lets you code surveys, questionnaires, quizzes, etc... and add them to your app.
Ruby
5
star
18

qoop

Qoop - Qooperative Qooking
JavaScript
4
star
19

go-opentsdb

Golang library to interact with OpenTSDB
Go
4
star
20

qnorr-styles

[WIP] A style agnostic, slightly opinionated, sass seasoning to bootstrap your projects
CSS
3
star
21

sidekiq-worker_stats

Statistics for sidekiq workers
Ruby
2
star
22

qultivator-firmware

Qultivator is a project built under 32h for the Whitesmith Hackathon (July 2016).
Arduino
2
star
23

fiware-orion-docker

Containerized FIWARE Orion using Docker and Docker Compose.
2
star
24

WSPopup

A simple and flexible way to show a view to the screen.
Swift
1
star
25

prosperent

A rails wrapper for prosperent API
Ruby
1
star
26

ARPlayground

Repo for AR experiences
JavaScript
1
star
27

rails-template

Whitesmith Ruby-on-Rails Template
Ruby
1
star
28

fiware-orion-deps-docker

FIWARE Orion dependencies image.
1
star
29

sassqit

Static Site Prototyper
CSS
1
star