{"id":22353719,"url":"https://github.com/rosberry/tribulus","last_synced_at":"2025-07-30T08:34:28.794Z","repository":{"id":56924519,"uuid":"101872773","full_name":"rosberry/Tribulus","owner":"rosberry","description":"Convenient way to compose attributed strings","archived":false,"fork":false,"pushed_at":"2017-09-18T03:03:57.000Z","size":618,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-01T09:17:37.436Z","etag":null,"topics":["attributes","ios","nsattributedstring","swift","uikit"],"latest_commit_sha":null,"homepage":"https://rosberry.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosberry.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-30T11:20:44.000Z","updated_at":"2020-04-15T03:59:40.000Z","dependencies_parsed_at":"2022-08-21T06:20:07.186Z","dependency_job_id":null,"html_url":"https://github.com/rosberry/Tribulus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FTribulus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FTribulus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FTribulus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FTribulus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosberry","download_url":"https://codeload.github.com/rosberry/Tribulus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228114885,"owners_count":17871742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attributes","ios","nsattributedstring","swift","uikit"],"created_at":"2024-12-04T13:09:34.603Z","updated_at":"2024-12-04T13:09:35.301Z","avatar_url":"https://github.com/rosberry.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/tribulus_logo.png\" alt=\"Tribulus\"/\u003e\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/rosberry/Tribulus.svg?branch=master)](https://travis-ci.org/rosberry/Tribulus)\n[![Version](https://img.shields.io/cocoapods/v/Tribulus.svg?style=flat)](http://cocoadocs.org/docsets/Tribulus)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/Tribulus.svg?style=flat)](http://cocoadocs.org/docsets/Tribulus)\n![Swift 3.0.x](https://img.shields.io/badge/Swift-3.0.x-orange.svg)\n[![Test Coverage](https://img.shields.io/badge/coverage-100%25-yellow.svg)](https://github.com/rosberry/Tribulus)\n[![License](https://img.shields.io/cocoapods/l/Tribulus.svg?style=flat)](http://cocoadocs.org/docsets/Tribulus)\n\n**Tribulus** provides very convenient way to compose attributed strings.\nIt is a framework based on usage custom `Attributes` class and nice chaining syntax.\n\n# Installation 🏁\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\nTo integrate Tribulus into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"rosberry/Tribulus\"\n```\n\nRun `carthage update` to build the framework and drag the built `Tribulus.framework` into your Xcode project.\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Swift and Objective-C Cocoa projects. It has over eighteen thousand libraries and can help you scale your projects elegantly. You can install it with the following command:\n\n```bash\n$ sudo gem install cocoapods\n```\n\nTo integrate Tribulus via CocoaPods, just add the following line to your `Podfile`:\n\n```ruby\npod \"Tribulus\"\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Manually\n\nDrag `Sources` folder from [latest release](https://github.com/rosberry/Tribulus/releases) into your project.\n\n# Usage 🏄‍\n\n### Initialization\n\nTo initialize attributed string with required attributes, you can use following code:\n\n```swift\nlet attributedString = NSAttributedString(string: testString) {\n\t\t$0.font = .systemFont(ofSize: 10, weight: UIFontWeightBold)\n        \t$0.backgroundColor = .green\n        \t$0.color = .black\n        \t$0.baselineOffset = 14.0\n    \t    }\n```\n\n### Appending\n\n**Tribulus** also allows appending to existing mutable attributed string.\n\nHere's a code for appending new attributed string:\n\n```swift\nlet attributedString = NSMutableAttributedString(string: \"Foo\")\nattributedString\n    \t.append(string: \" Bar\") {\n            $0.color = .red\n        }\n        .append(string: \" Baz\") {\n            $0.direction = .horizontal\n        }\n```\n\nAnd in the same simple way you can append any image:\n\n```swift\nlet attributedString = NSMutableAttributedString(string: \"Foo\")\nattributedString.append(image: UIImage(named: \"Bar\"), \n    \t\t\tbounds: CGRect(x: 0, y: 0, width: 40, height: 40))\n```\n### Insertion\n\nMoreover **Tribulus** allows you to insert newly configured attributed string at any location:\n\n```swift\nlet attributedString = NSMutableAttributedString(string: \"Foo  Baz\")\n attributedString\n\t.insert(string: \"Bar\", at: 4) {\n            $0.textEffect = .letterpress\n        }\n```\n\nor to insert an image:\n\n```swift\nattributedString.insert(image: UIImage(named: \"Bar\"), \n\t\t\tbounds: CGRect(x: 0, y: 0, width: 40, height: 40), \n                        at: 0)\n```\n\n### Additions\n\nInstead on creating `UIFontDescriptorSymbolicTraits` you can just set **bold** and **italic** traits using `Attributes` object properties:\n\n```swift\nlet attributedString = NSAttributedString(string: testString) {\n\t\t$0.bold = true\n    \t\t$0.italic = true\n\t    }\n```\n\n# Author 🖌\n\nDmitry Frishbuter, dmitry.frishbuter@rosberry.com\n\n# About\n\n\u003cimg src=\"https://github.com/rosberry/Foundation/blob/master/Assets/logo.png?raw=true\" width=\"100\" /\u003e\n\nThis project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.\n\nCheck out our [open source projects](https://github.com/rosberry), read [our blog](https://medium.com/@Rosberry) or give us a high-five on 🐦 [@rosberryapps](http://twitter.com/RosberryApps).\n\n# License 📃\n\nTribulus is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosberry%2Ftribulus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosberry%2Ftribulus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosberry%2Ftribulus/lists"}