CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Feb 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by prema janoti.
It is a custom tag view. It can add and delete new tags from view.
If you have already installed Cocoa Pods then you can skip this step.
$ [sudo] gem install cocoapods
$ pod setup
TagControl
podOnce 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.
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?
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
}
}
func didTapDoneButton(selectedTags: [String]) {
print(selectedTags)
self.removeTagView()
}
func didTapCancelButton() {
self.removeTagView()
}