clo

CloudTagView

A custom view to create cloud of tags.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

87

Maintenance

Last Commit

4yrs ago

Contributors

4

Package

Dependencies

0

License

MIT

Categories

Readme

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.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial