Tribute alternatives and similar libraries
Based on the "Text" category.
Alternatively, view Tribute alternatives based on common mentions on social networks and blogs.
-
PhoneNumberKit
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. -
ZSSRichTextEditor
A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view -
FontAwesomeKit
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. -
Atributika
Easily build NSAttributedString by detecting and styling HTML-like tags, hashtags, mentions, RegExp or NSDataDetector patterns. -
Highlighter
Highlight whatever you want! Highlighter will magically find UI objects such as UILabel, UITextView, UITexTfield, UIButton in your UITableViewCell or other Class. -
NSStringEmojize
A category on NSString to convert Emoji Cheat Sheet codes to their equivalent Unicode characters. -
Mustard
Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. -
GoogleMaterialDesignIcons
Google Material Design Icons Font for iOS. -
Heimdall
Heimdall is a wrapper around the Security framework for simple encryption/decryption operations. -
AttributedTextView
Easiest way to create an attributed UITextView with support for multiple links (including hashtags and mentions).
Get performance insights in less than 4 minutes
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of Tribute or a related project?
README
Tribute 
let string = NSMutableAttributedString().add("Hello ") {
$0.font = .systemFontOfSize(20)
$0.color = .redColor()
$0.underline = .StyleSingle
}.add("world ") {
$0.stroke = .Filled(width: 2)
$0.strokeColor = .orangeColor()
}.add("of Swift "){
$0.font = .systemFontOfSize(12)
$0.underline = nil
$0.URL = NSURL(string: "http://swift.org")!
}.add(UIImage(named: "swift")!)
Not bad comparing to
let string2 = NSMutableAttributedString()
string2.appendAttributedString(NSAttributedString(string: "Hello ", attributes: [
NSFontAttributeName: UIFont.systemFontOfSize(20),
NSUnderlineStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue,
NSForegroundColorAttributeName: UIColor.redColor()
]))
string2.appendAttributedString(NSAttributedString(string: "world ", attributes: [
NSFontAttributeName: UIFont.systemFontOfSize(20),
NSUnderlineStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue,
NSForegroundColorAttributeName: UIColor.redColor(),
NSStrokeColorAttributeName: UIColor.orangeColor(),
NSStrokeWidthAttributeName: -2
]))
string2.appendAttributedString(NSAttributedString(string: "of Swift ", attributes: [
NSFontAttributeName: UIFont.systemFontOfSize(12),
NSForegroundColorAttributeName: UIColor.redColor(),
NSStrokeColorAttributeName: UIColor.orangeColor(),
NSStrokeWidthAttributeName: -2
]))
let attachment = NSTextAttachment()
attachment.image = UIImage(named: "swift")
string2.appendAttributedString(NSAttributedString(attachment: attachment))
Design Goals
- Word processor logic: appending a string should inherit last attributes.
- Allow for easy customization of common properties, including toggle bold or change the font size.
- Flatten paragraph style and attributes, no more 5 lines of code if all you wanted is to change text alignment.
- Replace weird attributes with more reasonable versions (for example
Attribute.Stroke
vs NSStrokeWidthAttributeName). - Minimal overhead: produce only required attributes.
- Have an attributed string ready to use every time you leave the configuration block.
- Replace string constants with strongly typed enums where possible.
Notes
Playground
Playgrounds do not always render NSAttributesString
correctly (font variations and attachments are few of the problematic I noticed).
Workaround: Use a UILabel
as a live view instead: XCPlaygroundPage.currentPage.liveView = label
.
Font variations
Not all fonts have both italic and bold variations
Workaround: Use obliqueness
property as a poor man italic, and expansion
as a bold respectively.
Closure with one statement
When the configuration closure includes only one statement, compiler gets confused
Workaround: Specify closure type explicitly like so
string.add("text") { (inout a: Attributes) in
a.color = .redColor()
}
If you know a better way, please open a PR, I'd love to learn from it!
Roadmap
- [ ] Objective-C compatibility
- [ ] Moar attributes (PRs are welcome)
This is just a tribute