Skip to content

yasirdx777/DXTagsView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DXTagsView

Version License Platform

Features

  • Easy to use
  • Light weight
  • Multi-select and deselect tags
  • Easily get selected tags index
  • Customizable tags arranged alignment
  • Customizable tags scroll direction
  • Customizable tags minimum Line spacing and interitem spacing
  • Customizable tags view background color
  • Customizable tag text color selected/unselected
  • Customizable tag text alignment color selected/unselected
  • Customizable tag background color color selected/unselected
  • Customizable tag border width color selected/unselected
  • Customizable tag corner radius color selected/unselected
  • Customizable tag border color selected/unselected

alt text

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

DXTagsView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DXTagsView'

Usage

First import DXTagsView

import DXTagsView

And prepare the DXTagsView data model.

    private var tagViewConfig:DXTagViewConfig!
    
    var tagsConfig = [DXTagConfig]()
        
    for i in 1...30 {
            tagsConfig.append(DXTagConfig(id: i, text: "Tag \(i)"))
    }
        
    tagViewConfig = DXTagViewConfig(id: 1, tagsConfig: tagsConfig)

Then create the DXTagsView VC and initiate it with the data model you prepared.

    private var tagsViewController: DXTagsView!
    
    tagsViewController = DXTagsView(tagViewConfig: tagViewConfig)

In the end just add tagsViewController as child VC warped in a container view.

    private lazy var containerView = UIView()
    
    containerView.translatesAutoresizingMaskIntoConstraints = false
        
    NSLayoutConstraint.activate([containerView.topAnchor.constraint(equalTo: view.topAnchor, constant: 40),
                                     containerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 12),
                                     containerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 12),
                                     containerView.heightAnchor.constraint(equalToConstant: 300)])
        
        
        
    displayDXTagsView(tagsViewContainer: containerView, contentController: tagsViewController)

And to get the selected tags index

    let tagsIndex = tagsViewController.getSelectedIndexPaths()

Author

Yasir Romaya, yasir.romaya@gmail.com

License

DXTagsView is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published