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.
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
To run the example project, clone the repo, and run pod install from the Example directory first.
CloudTagView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CloudTagView'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))
}
}
}let normalTag = TagView(text: "normal tag")let fatTag = TagView(text: "fat tag")
fatTag.marginTop = 20let longTag = TagView(text: "stretched tag")
longTag.marginLeft = 40let trimmedTag = TagView(text: "Trimmed: This tag is a example of tag with a huge text.")
trimmedTag.maxLength = 15let withoutIconTag = TagView(text: "tag without dismiss icon")
withoutIconTag.iconImage = nillet customFontTag = TagView(text: "different font tag")
customFontTag.font = UIFont(name: "Baskerville", size: 12)!let coloredTag = TagView(text: "colored tag")
coloredTag.backgroundColor = UIColor.blue.withAlphaComponent(0.6)let tintColorTag = TagView(text: "tint color tag")
tintColorTag.tintColor = UIColor.yellowfunc tagDismissed(_ tag: TagView)func tagTouched(_ tag: TagView)Henrique Morbin, [email protected]
CloudTagView is available under the MIT license. See the LICENSE file for more info.
