Giter VIP home page Giter VIP logo

taglistview's Introduction

TagListView

Travis CI Version License Carthage compatible

Simple and highly customizable iOS tag list view, in Swift.

Supports Storyboard, Auto Layout, and @IBDesignable.

Screenshot

Usage

The most convenient way is to use Storyboard. Drag a view to Storyboard and set Class to TagListView (if you use CocoaPods, also set Module to TagListView). Then you can play with the attributes in the right pane, and see the preview in real time thanks to @IBDesignable.

Interface Builder

You can add tag to the tag list view, or set custom font and alignment through code:

tagListView.textFont = UIFont.systemFont(ofSize: 24)
tagListView.alignment = .center // possible values are [.leading, .trailing, .left, .center, .right]

tagListView.addTag("TagListView")
tagListView.addTags(["Add", "two", "tags"])

tagListView.insertTag("This should be the second tag", at: 1)

tagListView.setTitle("New Title", at: 6) // to replace the title a tag

tagListView.removeTag("meow") // all tags with title “meow” will be removed
tagListView.removeAllTags()

You can implement TagListViewDelegate to receive tag pressed event:

// ...
{
    // ...
    tagListView.delegate = self
    // ...
}

func tagPressed(title: String, tagView: TagView, sender: TagListView) {
    print("Tag pressed: \(title), \(sender)")
}

You can also customize a particular tag, or set tap handler for it by manipulating the TagView object returned by addTag(_:):

let tagView = tagListView.addTag("blue")
tagView.tagBackgroundColor = UIColor.blueColor()
tagView.onTap = { tagView in
    print("Don’t tap me!")
}

Be aware that if you update a property (e.g. tagBackgroundColor) for a TagListView, all the inner TagViews will be updated.

Installation

Use CocoaPods:

pod 'TagListView', '~> 1.0'

Or Carthage:

github "ElaWorkshop/TagListView" ~> 1.0

Or drag TagListView folder into your project.

Older Swift Versions?

Currently, the master branch is using Swift 5.

For Swift 4, use version 1.3.2 or swift-4 branch. For Swift 3, use version 1.2.0 or swift-3 branch. For Swift 2, use version 1.0.1 or swift-2.3 branch. For Swift 1.2, use version 0.2.

Contribution

Pull requests are welcome! If you want to do something big, please open an issue to let me know first.

License

MIT

taglistview's People

Contributors

xhacker avatar benuuu avatar joeferrucci avatar kitasuke avatar vinu-vanjari avatar cee avatar csvenja avatar aleene avatar danielgindi avatar ronkliffer avatar takuoka avatar aaronpearce avatar djbe avatar xbeg9 avatar uberjason avatar marcelofabri avatar morizotter avatar nick-the-uncharted avatar redent avatar anti-transmission avatar migfabio avatar gersonmdesouza avatar krezzoid avatar uson1x avatar joogps avatar kajensen avatar griffinmacias avatar matsoftware avatar philipheinser avatar rolandasrazma avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.