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

Related tags

UI TagListView
Overview

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.minWidth = 57

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

Comments
  • TagListView 1.1.0 Swift 3.0 EXC_BAD_ACCESS

    TagListView 1.1.0 Swift 3.0 EXC_BAD_ACCESS

    while adding tags to the taglistview I am gettiing exc_bad_access error. How to resolve this one.


    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    question wontfix 
    opened by gsujathap 27
  • Incorrect height when using auto size UITableViewCell

    Incorrect height when using auto size UITableViewCell

    It's a little bit difficult to describe this problem, so I create a demo(Xcode 8 and Swift 3.0) to show this case.

    I using autoLayout to make the TagListView equal to cell's contentView. But the first time load UITableView, you can see UITableViewCell height is not correct.

    After scroll out the cell(invisible), and scroll back, the cell shows correctly.

    I think this problem may cause by function intrinsicContentSize.

    bug question 
    opened by tinpont 24
  • Incorrect sizing in UITableViewCell depending on frame in storyboard (project attached)

    Incorrect sizing in UITableViewCell depending on frame in storyboard (project attached)

    Hi there,

    I've noticed that the TagListView, when configured in a UITableViewCell in a storyboard, may incorrectly render with the bottom cut off depending on the size of the view controller in the storyboard. I've created a quick project to demonstrate the problem: https://github.com/UberJason/TagListViewStoryboardBug

    I tried to look through the code of TagListView quickly, but nothing jumped out at me to explain the problem. Hope you might have a better idea than I do!

    question 
    opened by UberJason 20
  • Problem after updating pod to 1.3.1 version / Swift 4.2

    Problem after updating pod to 1.3.1 version / Swift 4.2

    Guys, could you suggest, what I am doing wrong. In project I see, that TagListView pod was updated successfully to latest version 1.3.1. I checked it few times. However the code of pod seems to be still not at Swift 4.2. Check my screenshot for reference.
    http://snpy.in/lohHYG http://snpy.in/xaeMd7 Probably I did something wrong, but can figure out what exactly.

    opened by Kharauzov 10
  • Add multi tags at one time

    Add multi tags at one time

    Can I add multi tags at one time? Something like addTags function.

    Now I can just add tag one by one, which will slow down performance.

    - (NSArray<TagView *> *)addTags:(NSArray<NSString *> *)tagNames {
        for (NSString *tagName in tagNames) {
            [self addTag:tagName];
        }
        return self.tagViews;
    }
    
    feature request 
    opened by tinpont 8
  • Drag into project, then swift compile error

    Drag into project, then swift compile error

    Problem : Swift compiler error in TagView .

    2018-06-27 6 51 00

    I use cocoaPods in my project, but I need some customize in TagListView.
    So I drag TagListView folder in my project. Then Swift compiler error... ( use Swift 4.1)

    question 
    opened by CACRogerWang 7
  • Fixes #43 - Invalidate intrinsic content size on rearrange of views

    Fixes #43 - Invalidate intrinsic content size on rearrange of views

    When the views are rearranged, we need to invalidate the existing intrinsic content size of the TagListView to update sizing elsewhere.

    This fixes #43 but updating the size of the TagListView when it is updated with new data, forcing the self sizing cells to correctly resize.

    opened by aaronpearce 6
  • How would we center the tags?

    How would we center the tags?

    I would like to center all the tags so we don't have all the spaces in the right of our view. Like Flipboard for example: img_1109

    How would we get this to work??

    feature request 
    opened by sehunchoi 6
  • Deleting tags

    Deleting tags

    Hey,

    I haven't downloaded or played with the code yet, but this is something I'm thinking of using very soon in my app. I was just wondering if maybe there's a way to have something like an "X" to delete and its own dedicated touch event for it?

    So in other words, I'd like the user to be easily remove tags manually by pressing the "X" icon, without having to go into an "edit" mode. I was thinking of having a the "X" to the left and then to the right the normal text.

    feature request 
    opened by jyounus 6
  • Multiple text colour in array does not set

    Multiple text colour in array does not set

    I have the tags and colour in an array and I set the tag by adding addTag property and the text colour for that tag, but they only pick the text colour of the last element in the array.

    question wontfix 
    opened by naveen114 5
  • tagRemoveButtonPressed stop working suddenly

    tagRemoveButtonPressed stop working suddenly

    When I click on tag following action is being called

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

    but when I click on closeButton

    func tagRemoveButtonPressed(_ title: String, tagView: TagView, sender: TagListView) {
    
    }
    

    was not being called it was working previously but suddenly stop working.

    I am using Xcode 9.3

    wontfix 
    opened by shaharukhs 5
  • Update image and position of remove button

    Update image and position of remove button

    Hi, I am using this library from years and it is really good. At this point I want to change image of remove button and its position before the tag text instead of at the end. Please help how can I do this.

    opened by ranamateen 0
  • Version 1.4.1 don’t have minwidth

    Version 1.4.1 don’t have minwidth

    Version CocoaPods 1.4.1 don’t have minWidth. The packaged version does not include minWidth: https://github.com/ElaWorkshop/TagListView/archive/refs/tags/1.4.1.zip

    opened by tranhoanganh 1
Releases(1.4.1)
Owner
Ela Workshop
Two craftsmen living in the middle-earth.
Ela Workshop
Easy to use, highly customizable gauge view

GDGauge - Customizable Gauge View Requirements Xcode 11+ Swift 5 iOS 9+ Installation Swift Package Manager .package(url: "https://github.com/saeid/GDG

Saeid 74 Dec 5, 2022
Highly customizable Action Sheet Controller with Assets Preview written in Swift

PPAssetsActionController Play with me ▶️ ?? If you want to play with me, just tap here and enjoy! ?? ?? Show me ?? Try me ?? The easiest way to try me

Pavel Pantus 72 Feb 4, 2022
📖 A simple, highly informative page view controller

TL;DR UIPageViewController done properly. ⭐️ Features Simplified data source management & enhanced delegation. Dynamically insert & remove pages. Infi

UI At Six 1.8k Dec 24, 2022
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
A highly configurable and out-of-the-box-pretty UI library

We absolutely love beautiful interfaces! As an organization named Unicorn, we are obligated to be unique and majestic.

Clayton (McIlrath) Unicorn 225 Feb 11, 2022
SwiftUI components and extensions that seem to be highly reusable

SwiftUI components and extensions that seem to be highly reusable

Yusuke Hosonuma 56 Dec 15, 2022
A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Seed 867 Dec 27, 2022
List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model and doesn't depend on UI framework

SwiftListTreeDataSource List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model, so can

Dzmitry Antonenka 26 Nov 26, 2022
Declarative, configurable & highly reusable UI development as making Lego bricks.

LeeGo is a lightweight Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks, to make UI dev

WANG Shengjia 969 Dec 29, 2022
Advanced List View for SwiftUI with pagination & different states

AdvancedList This package provides a wrapper view around the SwiftUI List view which adds pagination (through my ListPagination package) and an empty,

Chris 246 Jan 3, 2023
A beautiful radar view to show nearby items (users, restaurants, ...) with ripple animation, fully customizable

HGRippleRadarView Example To run the example project, clone the repo, and run pod install from the Example directory first. This project is inspired b

Hamza Ghazouani 352 Dec 4, 2022
The CITPincode package provides a customizable pincode view

The CITPincode package provides a customizable pincode view. It includes an optional resend code button with a built-in cooldown and an optional divider to be placed anywhere between the cells.

Coffee IT 3 Nov 5, 2022
Fetch the star wars api from all the planets and list and show details using Swift UI and Combine

Star Wars Planets Fetch the star wars planet data by using stat war api, list and show details using SwiftUI and Combine frameworks ?? Swift UI Framew

null 1 Aug 10, 2022
Elimination-backoff stack is an unbounded lock-free LIFO linked list, that eliminates concurrent pairs of pushes and pops with exchanges.

Elimination-backoff stack is an unbounded lock-free LIFO linked list, that eliminates concurrent pairs of pushes and pops with exchanges. It uses compare-and-set (CAS) atomic operation to provide concurrent access with obstruction freedom. In order to support even greater concurrency, in case a push/pop fails, it tries to pair it with another pop/push to eliminate the operation through exchange of values.

Ebubechukwu Dimobi 0 Dec 26, 2021
Reel Search is a Swift UI controller that allows you to choose options from a list

REEL SEARCH Reel Search is a Swift UI controller that allows you to choose options from a list We specialize in the designing and coding of custom UI

Ramotion 2.5k Dec 21, 2022
Modular and customizable Material Design UI components for iOS

Material Components for iOS Material Components for iOS (MDC-iOS) helps developers execute Material Design. Developed by a core team of engineers and

Material Components 4.6k Dec 29, 2022
A customizable color picker for iOS in Swift

IGColorPicker is a fantastic color picker ?? written in Swift. Table of Contents Documentation Colors Style Other features Installation Example Gettin

iGenius 272 Dec 17, 2022
🏞 A simple iOS photo and video browser with optional grid view, captions and selections written in Swift5.0

Introduction ?? MediaBrowser can display one or more images or videos by providing either UIImage objects, PHAsset objects, or URLs to library assets,

Kyle Yi 631 Dec 29, 2022