Latest 0.0.3
Homepage https://github.com/pjanoti/TagControl
License MIT
Platforms ios 9.0, requires ARC
Frameworks Foundation, UIKit
Authors

It is a custom tag view. It can add and delete new tags from view.

Install Cocoa Pods

If you have already installed Cocoa Pods then you can skip this step.

$ [sudo] gem install cocoapods
$ pod setup
Install TagControl pod

Once Cocoa Pods has been installed, you can add TagControl iOS Component to your project by adding a dependency entry to the Podfile in your project root directory.

$ edit Podfile
platform :ios, '9.0'
pod 'TagControl'

This sample shows a minimal Podfile that you can use to add TagControl iOS Component dependency to your project.
You can include any other dependency as required by your project.

Now you can install the dependencies in your project:

$ pod install

Once you install a pod dependency in your project, make sure to always open the Xcode workspace instead of the project file when building your project:

$ open App.xcworkspace

Now you can import TagControl in your source files:

Swift

import TagControl

At this point TagControl iOS Component is ready for use in your project.

TagControl Component Usage Guideline

How to import?

Step 1. Go to your ViewController.swift & import TagControl

Step 2. Go to your ViewController.swift & add TagViewDelegate

Step 3. Create a variable of type TagView

 var tagView: TagView?
How to use?
Within your ViewController add below code.
you can call self.addTagView() from anywhere you want like on button tap or viewDidLoad()
    @IBAction func btnShowTagsTapped(_ sender: Any) {
        self.addTagView()
    } 
 func addTagView() {
        if self.tagView != nil {
            self.tagView?.removeFromSuperview()
            self.tagView = nil
        }
        let contents = self.tagViewContents()
        self.tagView = TagView.initTagView(contents, delegate: self)
        self.view.addSubview(self.tagView!)
        self.tagView?.setupInitialConstraintWRTView(self.view)
    }
     func tagViewContents() -> [String]? {
        var tags = [String]()
        tags = ["Prema", "Photography", "Design", "Humor", "Love Traveling", "Music", "Writing", "Easy Life", "Education", "Engineer", "Startup", "Funny", "Women In Tech", "Female", "Business", "Songs", "Love", "Food", "Sports"]
        return tags
    }
    func removeTagView() {
        if self.tagView != nil {
            self.tagView?.removeFromSuperview()
            self.tagView = nil
        }
    }
Implement delegate method
  func didTapDoneButton(selectedTags: [String]) {
        print(selectedTags)
        self.removeTagView()
    }

    func didTapCancelButton() {
       self.removeTagView()
    }    

Here we have tag control :)

ScreenShot –

Latest podspec

{
    "name": "TagControl",
    "version": "0.0.3",
    "summary": "It is a custom tag view. It can add and delete tags from view.",
    "description": "It is a custom tag view. It can add and delete tags from view. you can set the different properties of TagControl like `backGroundColor`, `separatorView.backGroundColor etc if you need to customize it otherwise it will take default values.",
    "homepage": "https://github.com/pjanoti/TagControl",
    "license": {
        "type": "MIT",
        "file": "FILE_LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/pjanoti/TagControl.git",
        "branch": "master",
        "tag": "0.0.3"
    },
    "source_files": "Classes/**/*.{swift}",
    "resources": "Classes/**/*.{xib}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This