Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make tag list in Swift?

Tags:

ios

swift

tags

I want to create a list of tags, what I'll take from an array, but how can I stylize it as:

enter image description here

inside of bubbles and auto place in the next row if the line is full. Any tips or ideas?

like image 737
Orkhan Alizade Avatar asked Nov 10 '15 08:11

Orkhan Alizade


People also ask

How do you use tags in Swift?

If you want to use a view in code, declare an outlet for it and connect it. If you want to iterate over several views, create an array from your outlets or use a collection of outlets: @IBOutlet var buttons: [UIButton]! As an added bonus, now we can for in through these.


2 Answers

enter image description hereI have implemented a simple and customizable tag list view in swift using a collection view.

Here is my github link.

like image 94
Samiul Islam Sami Avatar answered Oct 05 '22 00:10

Samiul Islam Sami


Please read this library link giving below it has awesome and custom tag design all the things you required for your design.

https://github.com/ElaWorkshop/TagListView

Here is how to use it.

  1. add its cocoapods [pod "TagListView"].
  2. Create a view on which you wanna to show your selected tags and constraint it.
  3. change your view class name to "TagListView".
  4. set delegate on viewDidLoad(). [yourView.delegate = self]
  5. now you use it. eg.

yourView.addTag("Name on Tag") or yourView.addTags(["Name on Tag First","Name on Tag second","Name on tag third",.....and so on])

like image 40
MRizwan33 Avatar answered Oct 04 '22 23:10

MRizwan33