A custom view to create cloud of tags.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 30b4e22 Jan 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Testing PullRequests Jan 4, 2018
Pod Merge pull request #15 from clineu/swift4 Jan 4, 2018
.gitignore Removing pods Sep 1, 2016
.swift-version swift version Nov 5, 2016
.travis.yml Initial commit Jan 27, 2016
CloudTagView.podspec Update to swift 4 Jan 4, 2018
LICENSE Initial commit Jan 27, 2016
README.md Update README.md Jan 4, 2018
Screenshot.png Adding screenshot Jan 27, 2016
Screenshot2.png New screenshot Jul 11, 2016
Screenshot3.png font property Sep 1, 2016
_Pods.xcodeproj Initial commit Jan 27, 2016

README.md

CloudTagView

Version License Platform Swift 4.0 compatible

This Pod helps you to create a simple cloud of tags based on Strings. You can manipulate the text, the padding and you can use the tintColor to modify the tag color. There are two delegates to handle taps in the tag: close icon and tag touch. You can access the example project for more details or contacting me.

Requirements

It requires Xcode 9.0+ and Swift 4.0.

Your project deployment target must be iOS 8.0+

For Swift 2.x support, use version 1.1.0 For Swift 3.x support, use version 2.0.0

Usage

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

Installation

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

pod 'CloudTagView'

Usage

Basic Usage

Just import CloudTagView and create a instance of CloudTagView. Works with Storyboard too

And append instancies of TagView inside the cloud.

import CloudTagView

class ViewController: UIViewController {

    let cloudView = CloudTagView()

    override func viewDidLoad() {
        super.viewDidLoad()

        cloudView.frame = CGRect(x: 0, y: 20, width: view.frame.width, height: 10)
        view.addSubview(cloudView)

        setupTags()
    }

    fileprivate func setupTags() {
        let tags = ["This", "is", "a", "example", "of", "Cloud", "Tag", "View"]

        for tag in tags {
            cloudView.tags.append(TagView(text: tag))
        }
    }
}

Other tags

Normal
let normalTag = TagView(text: "normal tag")
Fat
let fatTag = TagView(text: "fat tag")
fatTag.marginTop = 20
Long
let longTag = TagView(text: "stretched tag")
longTag.marginLeft = 40
Trimmed
let trimmedTag = TagView(text: "Trimmed: This tag is a example of tag with a huge text.")
trimmedTag.maxLength = 15
Without Icon
let withoutIconTag = TagView(text: "tag without dismiss icon")
withoutIconTag.iconImage = nil
Custom Font
let customFontTag = TagView(text: "different font tag")
customFontTag.font = UIFont(name: "Baskerville", size: 12)!
Custom Background Color
let coloredTag = TagView(text: "colored tag")
coloredTag.backgroundColor = UIColor.blue.withAlphaComponent(0.6)
Custom Tint Color
let tintColorTag = TagView(text: "tint color tag")
tintColorTag.tintColor = UIColor.yellow

TagViewDelegate

Dismiss Event
func tagDismissed(_ tag: TagView)
Touch Event
func tagTouched(_ tag: TagView)

Author

Henrique Morbin, morbin_@hotmail.com

License

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